Merge pull request #42737 from thaJeztah/integratione_network_remove_duplicate_code

integration/network: remove dead code
This commit is contained in:
Brian Goff 2021-08-12 11:38:44 -07:00 committed by GitHub
commit 9e5e846c8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 29 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,12 +5,10 @@ package network
import (
"context"
"fmt"
"os"
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/parsers/kernel"
"gotest.tools/v3/assert/cmp"
"gotest.tools/v3/icmd"
)
@ -74,21 +72,3 @@ func IsNetworkNotAvailable(c client.NetworkAPIClient, name string) cmp.Compariso
return cmp.ResultSuccess
}
}
// CheckKernelMajorVersionGreaterOrEqualThen returns whether the kernel version is greater or equal than the one provided
func CheckKernelMajorVersionGreaterOrEqualThen(kernelVersion int, majorVersion int) bool {
kv, err := kernel.GetKernelVersion()
if err != nil {
return false
}
if kv.Kernel < kernelVersion || (kv.Kernel == kernelVersion && kv.Major < majorVersion) {
return false
}
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)