瀏覽代碼

integration/network: remove IsUserNamespace in favor of testenv equivalent

We're already using testenv here, so might as well use the exact same
function that it provides.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父節點
當前提交
8a25d752a9

+ 1 - 1
integration/network/dns_test.go

@@ -16,7 +16,7 @@ import (
 func TestDaemonDNSFallback(t *testing.T) {
 func TestDaemonDNSFallback(t *testing.T) {
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
-	skip.If(t, IsUserNamespace())
+	skip.If(t, testEnv.IsUserNamespace)
 
 
 	d := daemon.New(t)
 	d := daemon.New(t)
 	d.StartWithBusybox(t, "-b", "none", "--dns", "127.127.127.1", "--dns", "8.8.8.8")
 	d.StartWithBusybox(t, "-b", "none", "--dns", "127.127.127.1", "--dns", "8.8.8.8")

+ 0 - 7
integration/network/helpers.go

@@ -5,7 +5,6 @@ package network
 import (
 import (
 	"context"
 	"context"
 	"fmt"
 	"fmt"
-	"os"
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
@@ -86,9 +85,3 @@ func CheckKernelMajorVersionGreaterOrEqualThen(kernelVersion int, majorVersion i
 	}
 	}
 	return true
 	return true
 }
 }
-
-// IsUserNamespace returns whether the user namespace remapping is enabled
-func IsUserNamespace() bool {
-	root := os.Getenv("DOCKER_REMAP_ROOT")
-	return root != ""
-}

+ 0 - 7
integration/network/helpers_windows.go

@@ -3,7 +3,6 @@ package network
 import (
 import (
 	"context"
 	"context"
 	"fmt"
 	"fmt"
-	"os"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
@@ -41,9 +40,3 @@ func IsNetworkNotAvailable(c client.NetworkAPIClient, name string) cmp.Compariso
 		return cmp.ResultSuccess
 		return cmp.ResultSuccess
 	}
 	}
 }
 }
-
-// IsUserNamespace returns whether the user namespace remapping is enabled
-func IsUserNamespace() bool {
-	root := os.Getenv("DOCKER_REMAP_ROOT")
-	return root != ""
-}

+ 1 - 1
integration/network/network_test.go

@@ -23,7 +23,7 @@ import (
 func TestRunContainerWithBridgeNone(t *testing.T) {
 func TestRunContainerWithBridgeNone(t *testing.T) {
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
-	skip.If(t, IsUserNamespace())
+	skip.If(t, testEnv.IsUserNamespace)
 	skip.If(t, testEnv.IsRootless, "rootless mode has different view of network")
 	skip.If(t, testEnv.IsRootless, "rootless mode has different view of network")
 
 
 	d := daemon.New(t)
 	d := daemon.New(t)