1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Sebastiaan van Stijn 2021-08-12 09:12:04 +02:00
parent 7681a3eb40
commit 8a25d752a9
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 2 additions and 16 deletions

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@ import (
func TestRunContainerWithBridgeNone(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
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")
d := daemon.New(t)