Signed-off-by: Christopher Crone <christopher.crone@docker.com>
| ... | ... |
@@ -55,15 +55,16 @@ RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash |
| 55 | 55 |
|
| 56 | 56 |
COPY contrib/httpserver/Dockerfile /tests/contrib/httpserver/Dockerfile |
| 57 | 57 |
COPY contrib/syscall-test /tests/contrib/syscall-test |
| 58 |
-COPY hack/test/e2e-run.sh /run.sh |
|
| 59 |
-COPY hack/make/.ensure-emptyfs /ensure-emptyfs.sh |
|
| 60 | 58 |
COPY integration-cli/fixtures /tests/integration-cli/fixtures |
| 61 | 59 |
|
| 60 |
+COPY hack/test/e2e-run.sh /scripts/run.sh |
|
| 61 |
+COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh |
|
| 62 |
+ |
|
| 62 | 63 |
COPY --from=builder /output/docker-frozen-images /docker-frozen-images |
| 63 | 64 |
COPY --from=builder /output/httpserver /tests/contrib/httpserver/httpserver |
| 64 | 65 |
COPY --from=builder /output/tests /tests |
| 65 | 66 |
COPY --from=builder /usr/local/bin/docker /usr/bin/docker |
| 66 | 67 |
|
| 67 |
-ENV DOCKER_E2E=1 DOCKER_REMOTE_DAEMON=1 DOCKER_INTEGRATION_DAEMON_DEST=/ |
|
| 68 |
+ENV DOCKER_REMOTE_DAEMON=1 DOCKER_INTEGRATION_DAEMON_DEST=/ |
|
| 68 | 69 |
|
| 69 |
-ENTRYPOINT ["/run.sh"] |
|
| 70 |
+ENTRYPOINT ["/scripts/run.sh"] |
| ... | ... |
@@ -1,15 +1,41 @@ |
| 1 | 1 |
#!/usr/bin/env bash |
| 2 | 2 |
set -e |
| 3 | 3 |
|
| 4 |
+TESTFLAGS=${TESTFLAGS:-""}
|
|
| 5 |
+# Currently only DockerSuite and DockerNetworkSuite have been adapted for E2E testing |
|
| 6 |
+TESTFLAGS_LEGACY=${TESTFLAGS_LEGACY:-""}
|
|
| 7 |
+TIMEOUT=${TIMEOUT:-60m}
|
|
| 8 |
+ |
|
| 9 |
+SCRIPTDIR="$(dirname ${BASH_SOURCE[0]})"
|
|
| 10 |
+ |
|
| 4 | 11 |
export DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:-amd64}
|
| 5 | 12 |
|
| 6 |
-echo "Ensure emptyfs image is loaded" |
|
| 7 |
-bash /ensure-emptyfs.sh |
|
| 13 |
+run_test_integration() {
|
|
| 14 |
+ run_test_integration_suites |
|
| 15 |
+ run_test_integration_legacy_suites |
|
| 16 |
+} |
|
| 17 |
+ |
|
| 18 |
+run_test_integration_suites() {
|
|
| 19 |
+ local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
|
|
| 20 |
+ for dir in /tests/integration/*; do |
|
| 21 |
+ if ! ( |
|
| 22 |
+ cd $dir |
|
| 23 |
+ echo "Running $PWD" |
|
| 24 |
+ ./test.main $flags |
|
| 25 |
+ ); then exit 1; fi |
|
| 26 |
+ done |
|
| 27 |
+} |
|
| 28 |
+ |
|
| 29 |
+run_test_integration_legacy_suites() {
|
|
| 30 |
+ ( |
|
| 31 |
+ flags="-check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS_LEGACY"
|
|
| 32 |
+ cd /tests/integration-cli |
|
| 33 |
+ echo "Running $PWD" |
|
| 34 |
+ ./test.main $flags |
|
| 35 |
+ ) |
|
| 36 |
+} |
|
| 8 | 37 |
|
| 9 |
-echo "Run integration/container tests" |
|
| 10 |
-cd /tests/integration/container |
|
| 11 |
-./test.main -test.v |
|
| 38 |
+bash $SCRIPTDIR/ensure-emptyfs.sh |
|
| 12 | 39 |
|
| 13 |
-echo "Run integration-cli tests (DockerSuite, DockerNetworkSuite)" |
|
| 14 |
-cd /tests/integration-cli |
|
| 15 |
-./test.main -test.v -check.v -check.f "DockerSuite|DockerNetworkSuite" |
|
| 40 |
+echo "Run integration tests" |
|
| 41 |
+run_test_integration |
| ... | ... |
@@ -117,7 +117,7 @@ func (s *DockerRegistrySuite) OnTimeout(c *check.C) {
|
| 117 | 117 |
} |
| 118 | 118 |
|
| 119 | 119 |
func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
|
| 120 |
- testRequires(c, DaemonIsLinux, registry.Hosting) |
|
| 120 |
+ testRequires(c, DaemonIsLinux, registry.Hosting, SameHostDaemon) |
|
| 121 | 121 |
s.reg = setupRegistry(c, false, "", "") |
| 122 | 122 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 123 | 123 |
Experimental: testEnv.ExperimentalDaemon(), |
| ... | ... |
@@ -151,7 +151,7 @@ func (s *DockerSchema1RegistrySuite) OnTimeout(c *check.C) {
|
| 151 | 151 |
} |
| 152 | 152 |
|
| 153 | 153 |
func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) {
|
| 154 |
- testRequires(c, DaemonIsLinux, registry.Hosting, NotArm64) |
|
| 154 |
+ testRequires(c, DaemonIsLinux, registry.Hosting, NotArm64, SameHostDaemon) |
|
| 155 | 155 |
s.reg = setupRegistry(c, true, "", "") |
| 156 | 156 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 157 | 157 |
Experimental: testEnv.ExperimentalDaemon(), |
| ... | ... |
@@ -185,7 +185,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) OnTimeout(c *check.C) {
|
| 185 | 185 |
} |
| 186 | 186 |
|
| 187 | 187 |
func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *check.C) {
|
| 188 |
- testRequires(c, DaemonIsLinux, registry.Hosting) |
|
| 188 |
+ testRequires(c, DaemonIsLinux, registry.Hosting, SameHostDaemon) |
|
| 189 | 189 |
s.reg = setupRegistry(c, false, "htpasswd", "") |
| 190 | 190 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 191 | 191 |
Experimental: testEnv.ExperimentalDaemon(), |
| ... | ... |
@@ -221,7 +221,7 @@ func (s *DockerRegistryAuthTokenSuite) OnTimeout(c *check.C) {
|
| 221 | 221 |
} |
| 222 | 222 |
|
| 223 | 223 |
func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) {
|
| 224 |
- testRequires(c, DaemonIsLinux, registry.Hosting) |
|
| 224 |
+ testRequires(c, DaemonIsLinux, registry.Hosting, SameHostDaemon) |
|
| 225 | 225 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 226 | 226 |
Experimental: testEnv.ExperimentalDaemon(), |
| 227 | 227 |
}) |
| ... | ... |
@@ -316,7 +316,7 @@ func (s *DockerSwarmSuite) OnTimeout(c *check.C) {
|
| 316 | 316 |
} |
| 317 | 317 |
|
| 318 | 318 |
func (s *DockerSwarmSuite) SetUpTest(c *check.C) {
|
| 319 |
- testRequires(c, DaemonIsLinux) |
|
| 319 |
+ testRequires(c, DaemonIsLinux, SameHostDaemon) |
|
| 320 | 320 |
} |
| 321 | 321 |
|
| 322 | 322 |
func (s *DockerSwarmSuite) AddDaemon(c *check.C, joinSwarm, manager bool) *daemon.Swarm {
|
| ... | ... |
@@ -468,7 +468,7 @@ func (ps *DockerPluginSuite) getPluginRepoWithTag() string {
|
| 468 | 468 |
} |
| 469 | 469 |
|
| 470 | 470 |
func (ps *DockerPluginSuite) SetUpSuite(c *check.C) {
|
| 471 |
- testRequires(c, DaemonIsLinux) |
|
| 471 |
+ testRequires(c, DaemonIsLinux, registry.Hosting) |
|
| 472 | 472 |
ps.registry = setupRegistry(c, false, "", "") |
| 473 | 473 |
|
| 474 | 474 |
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) |
| ... | ... |
@@ -1408,19 +1408,6 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs( |
| 1408 | 1408 |
c.Assert(err.Error(), checker.Contains, "container rootfs is marked read-only") |
| 1409 | 1409 |
} |
| 1410 | 1410 |
|
| 1411 |
-func (s *DockerSuite) TestContainerAPIGetContainersJSONEmpty(c *check.C) {
|
|
| 1412 |
- // E2E: Test assumes no other containers running. |
|
| 1413 |
- testRequires(c, NotE2E) |
|
| 1414 |
- |
|
| 1415 |
- cli, err := client.NewEnvClient() |
|
| 1416 |
- c.Assert(err, checker.IsNil) |
|
| 1417 |
- defer cli.Close() |
|
| 1418 |
- |
|
| 1419 |
- containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true})
|
|
| 1420 |
- c.Assert(err, checker.IsNil) |
|
| 1421 |
- c.Assert(containers, checker.HasLen, 0) |
|
| 1422 |
-} |
|
| 1423 |
- |
|
| 1424 | 1411 |
func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) {
|
| 1425 | 1412 |
// Not supported on Windows |
| 1426 | 1413 |
testRequires(c, DaemonIsLinux) |
| ... | ... |
@@ -119,8 +119,7 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
|
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 | 121 |
func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
|
| 122 |
- // E2E: Test runs local HTTP server. |
|
| 123 |
- testRequires(c, Network, NotE2E) |
|
| 122 |
+ testRequires(c, Network, SameHostDaemon) |
|
| 124 | 123 |
|
| 125 | 124 |
server := httptest.NewServer(http.NewServeMux()) |
| 126 | 125 |
defer server.Close() |
| ... | ... |
@@ -30,7 +30,7 @@ type DockerAuthzV2Suite struct {
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
func (s *DockerAuthzV2Suite) SetUpTest(c *check.C) {
|
| 33 |
- testRequires(c, DaemonIsLinux, Network) |
|
| 33 |
+ testRequires(c, DaemonIsLinux, Network, SameHostDaemon) |
|
| 34 | 34 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 35 | 35 |
Experimental: testEnv.ExperimentalDaemon(), |
| 36 | 36 |
}) |
| ... | ... |
@@ -64,6 +64,7 @@ type authorizationController struct {
|
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
func (s *DockerAuthzSuite) SetUpTest(c *check.C) {
|
| 67 |
+ testRequires(c, SameHostDaemon) |
|
| 67 | 68 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 68 | 69 |
Experimental: testEnv.ExperimentalDaemon(), |
| 69 | 70 |
}) |
| ... | ... |
@@ -25,20 +25,20 @@ import ( |
| 25 | 25 |
) |
| 26 | 26 |
|
| 27 | 27 |
func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
| 28 |
- // E2E: Test assumes no other containers running. |
|
| 29 |
- testRequires(c, cpuCfsQuota, NotE2E) |
|
| 28 |
+ testRequires(c, cpuCfsQuota) |
|
| 30 | 29 |
name := "testbuildresourceconstraints" |
| 30 |
+ buildLabel := "DockerSuite.TestBuildResourceConstraintsAreUsed" |
|
| 31 | 31 |
|
| 32 | 32 |
ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(` |
| 33 | 33 |
FROM hello-world:frozen |
| 34 | 34 |
RUN ["/hello"] |
| 35 | 35 |
`)) |
| 36 | 36 |
cli.Docker( |
| 37 |
- cli.Args("build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "-t", name, "."),
|
|
| 37 |
+ cli.Args("build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "--label="+buildLabel, "-t", name, "."),
|
|
| 38 | 38 |
cli.InDir(ctx.Dir), |
| 39 | 39 |
).Assert(c, icmd.Success) |
| 40 | 40 |
|
| 41 |
- out := cli.DockerCmd(c, "ps", "-lq").Combined() |
|
| 41 |
+ out := cli.DockerCmd(c, "ps", "-lq", "--filter", "label="+buildLabel).Combined() |
|
| 42 | 42 |
cID := strings.TrimSpace(out) |
| 43 | 43 |
|
| 44 | 44 |
type hostConfig struct {
|
| ... | ... |
@@ -50,6 +50,7 @@ type DockerExternalVolumeSuite struct {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
func (s *DockerExternalVolumeSuite) SetUpTest(c *check.C) {
|
| 53 |
+ testRequires(c, SameHostDaemon) |
|
| 53 | 54 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 54 | 55 |
Experimental: testEnv.ExperimentalDaemon(), |
| 55 | 56 |
}) |
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"net/http" |
| 11 | 11 |
"net/http/httptest" |
| 12 | 12 |
"os" |
| 13 |
- "path/filepath" |
|
| 14 | 13 |
"strings" |
| 15 | 14 |
"time" |
| 16 | 15 |
|
| ... | ... |
@@ -288,41 +287,6 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsDefault(c *check.C) {
|
| 288 | 288 |
} |
| 289 | 289 |
} |
| 290 | 290 |
|
| 291 |
-func (s *DockerSuite) TestNetworkLsFormat(c *check.C) {
|
|
| 292 |
- // E2E: Test assumes only default networks. |
|
| 293 |
- testRequires(c, DaemonIsLinux, NotE2E) |
|
| 294 |
- out, _ := dockerCmd(c, "network", "ls", "--format", "{{.Name}}")
|
|
| 295 |
- lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
|
| 296 |
- |
|
| 297 |
- expected := []string{"bridge", "host", "none"}
|
|
| 298 |
- var names []string |
|
| 299 |
- names = append(names, lines...) |
|
| 300 |
- c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
|
| 301 |
-} |
|
| 302 |
- |
|
| 303 |
-func (s *DockerSuite) TestNetworkLsFormatDefaultFormat(c *check.C) {
|
|
| 304 |
- // E2E: Test assumes only default networks. |
|
| 305 |
- testRequires(c, DaemonIsLinux, NotE2E) |
|
| 306 |
- |
|
| 307 |
- config := `{
|
|
| 308 |
- "networksFormat": "{{ .Name }} default"
|
|
| 309 |
-}` |
|
| 310 |
- d, err := ioutil.TempDir("", "integration-cli-")
|
|
| 311 |
- c.Assert(err, checker.IsNil) |
|
| 312 |
- defer os.RemoveAll(d) |
|
| 313 |
- |
|
| 314 |
- err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644) |
|
| 315 |
- c.Assert(err, checker.IsNil) |
|
| 316 |
- |
|
| 317 |
- out, _ := dockerCmd(c, "--config", d, "network", "ls") |
|
| 318 |
- lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
|
| 319 |
- |
|
| 320 |
- expected := []string{"bridge default", "host default", "none default"}
|
|
| 321 |
- var names []string |
|
| 322 |
- names = append(names, lines...) |
|
| 323 |
- c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
|
| 324 |
-} |
|
| 325 |
- |
|
| 326 | 291 |
func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *check.C) {
|
| 327 | 292 |
predefined := []string{"bridge", "host", "none", "default"}
|
| 328 | 293 |
for _, net := range predefined {
|
| ... | ... |
@@ -353,8 +317,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) {
|
| 353 | 353 |
} |
| 354 | 354 |
|
| 355 | 355 |
func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) {
|
| 356 |
- // E2E: Test assumes clean network environment. |
|
| 357 |
- testRequires(c, NotE2E) |
|
| 356 |
+ testRequires(c, OnlyDefaultNetworks) |
|
| 358 | 357 |
testNet := "testnet1" |
| 359 | 358 |
testLabel := "foo" |
| 360 | 359 |
testValue := "bar" |
| ... | ... |
@@ -519,9 +519,9 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
|
| 519 | 519 |
} |
| 520 | 520 |
|
| 521 | 521 |
func (s *DockerSuite) TestPsLinkedWithNoTrunc(c *check.C) {
|
| 522 |
- // E2E: Test assumes no other containers. |
|
| 523 | 522 |
// Problematic on Windows as it doesn't support links as of Jan 2016 |
| 524 |
- testRequires(c, DaemonIsLinux, NotE2E) |
|
| 523 |
+ testRequires(c, DaemonIsLinux) |
|
| 524 |
+ existingContainers := ExistingContainerIDs(c) |
|
| 525 | 525 |
runSleepingContainer(c, "--name=first") |
| 526 | 526 |
runSleepingContainer(c, "--name=second", "--link=first:first") |
| 527 | 527 |
|
| ... | ... |
@@ -529,6 +529,7 @@ func (s *DockerSuite) TestPsLinkedWithNoTrunc(c *check.C) {
|
| 529 | 529 |
lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
| 530 | 530 |
// strip header |
| 531 | 531 |
lines = lines[1:] |
| 532 |
+ lines = RemoveLinesForExistingElements(lines, existingContainers) |
|
| 532 | 533 |
expected := []string{"second", "first,second/first"}
|
| 533 | 534 |
var names []string |
| 534 | 535 |
for _, l := range lines {
|
| ... | ... |
@@ -632,20 +633,6 @@ func (s *DockerSuite) TestPsNamesMultipleTime(c *check.C) {
|
| 632 | 632 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with names displayed twice: %v, got: %v", expected, names))
|
| 633 | 633 |
} |
| 634 | 634 |
|
| 635 |
-func (s *DockerSuite) TestPsFormatHeaders(c *check.C) {
|
|
| 636 |
- // E2E: Test assumes no other containers. |
|
| 637 |
- testRequires(c, NotE2E) |
|
| 638 |
- |
|
| 639 |
- // make sure no-container "docker ps" still prints the header row |
|
| 640 |
- out, _ := dockerCmd(c, "ps", "--format", "table {{.ID}}")
|
|
| 641 |
- c.Assert(out, checker.Equals, "CONTAINER ID\n", check.Commentf(`Expected 'CONTAINER ID\n', got %v`, out)) |
|
| 642 |
- |
|
| 643 |
- // verify that "docker ps" with a container still prints the header row also |
|
| 644 |
- runSleepingContainer(c, "--name=test") |
|
| 645 |
- out, _ = dockerCmd(c, "ps", "--format", "table {{.Names}}")
|
|
| 646 |
- c.Assert(out, checker.Equals, "NAMES\ntest\n", check.Commentf(`Expected 'NAMES\ntest\n', got %v`, out)) |
|
| 647 |
-} |
|
| 648 |
- |
|
| 649 | 635 |
func (s *DockerSuite) TestPsDefaultFormatAndQuiet(c *check.C) {
|
| 650 | 636 |
existingContainers := ExistingContainerIDs(c) |
| 651 | 637 |
config := `{
|
| ... | ... |
@@ -14,6 +14,7 @@ import ( |
| 14 | 14 |
"github.com/docker/docker/client" |
| 15 | 15 |
"github.com/docker/docker/integration-cli/checker" |
| 16 | 16 |
"github.com/docker/docker/integration-cli/request" |
| 17 |
+ "github.com/docker/docker/pkg/parsers/kernel" |
|
| 17 | 18 |
"github.com/go-check/check" |
| 18 | 19 |
"github.com/kr/pty" |
| 19 | 20 |
) |
| ... | ... |
@@ -170,6 +171,18 @@ func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) {
|
| 170 | 170 |
c.Assert(strings.TrimSpace(out), checker.Equals, "314572800") |
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 |
+// GetKernelVersion gets the current kernel version. |
|
| 174 |
+func GetKernelVersion() *kernel.VersionInfo {
|
|
| 175 |
+ v, _ := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion) |
|
| 176 |
+ return v |
|
| 177 |
+} |
|
| 178 |
+ |
|
| 179 |
+// CheckKernelVersion checks if current kernel is newer than (or equal to) |
|
| 180 |
+// the given version. |
|
| 181 |
+func CheckKernelVersion(k, major, minor int) bool {
|
|
| 182 |
+ return kernel.CompareKernelVersion(*GetKernelVersion(), kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) > 0
|
|
| 183 |
+} |
|
| 184 |
+ |
|
| 173 | 185 |
func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *check.C) {
|
| 174 | 186 |
testRequires(c, DaemonIsLinux) |
| 175 | 187 |
testRequires(c, memoryLimitSupport) |
| ... | ... |
@@ -39,7 +39,7 @@ func newDockerHubPullSuite() *DockerHubPullSuite {
|
| 39 | 39 |
|
| 40 | 40 |
// SetUpSuite starts the suite daemon. |
| 41 | 41 |
func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
|
| 42 |
- testRequires(c, DaemonIsLinux) |
|
| 42 |
+ testRequires(c, DaemonIsLinux, SameHostDaemon) |
|
| 43 | 43 |
s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
|
| 44 | 44 |
Experimental: testEnv.ExperimentalDaemon(), |
| 45 | 45 |
}) |
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package main |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"fmt" |
| 5 | 6 |
"io/ioutil" |
| 6 | 7 |
"net/http" |
| ... | ... |
@@ -10,6 +11,8 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
"time" |
| 12 | 12 |
|
| 13 |
+ "github.com/docker/docker/api/types" |
|
| 14 |
+ "github.com/docker/docker/client" |
|
| 13 | 15 |
"github.com/docker/docker/integration-cli/requirement" |
| 14 | 16 |
) |
| 15 | 17 |
|
| ... | ... |
@@ -36,12 +39,16 @@ func DaemonIsLinux() bool {
|
| 36 | 36 |
return testEnv.DaemonInfo.OSType == "linux" |
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 |
-func E2E() bool {
|
|
| 40 |
- return os.Getenv("DOCKER_E2E") != ""
|
|
| 41 |
-} |
|
| 42 |
- |
|
| 43 |
-func NotE2E() bool {
|
|
| 44 |
- return !E2E() |
|
| 39 |
+func OnlyDefaultNetworks() bool {
|
|
| 40 |
+ cli, err := client.NewEnvClient() |
|
| 41 |
+ if err != nil {
|
|
| 42 |
+ return false |
|
| 43 |
+ } |
|
| 44 |
+ networks, err := cli.NetworkList(context.TODO(), types.NetworkListOptions{})
|
|
| 45 |
+ if err != nil || len(networks) > 0 {
|
|
| 46 |
+ return false |
|
| 47 |
+ } |
|
| 48 |
+ return true |
|
| 45 | 49 |
} |
| 46 | 50 |
|
| 47 | 51 |
// Deprecated: use skip.IfCondition(t, !testEnv.DaemonInfo.ExperimentalBuild) |
| 48 | 52 |
deleted file mode 100644 |
| ... | ... |
@@ -1,19 +0,0 @@ |
| 1 |
-// +build linux freebsd solaris openbsd |
|
| 2 |
- |
|
| 3 |
-package main |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "github.com/docker/docker/pkg/parsers/kernel" |
|
| 7 |
-) |
|
| 8 |
- |
|
| 9 |
-// GetKernelVersion gets the current kernel version. |
|
| 10 |
-func GetKernelVersion() *kernel.VersionInfo {
|
|
| 11 |
- v, _ := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion) |
|
| 12 |
- return v |
|
| 13 |
-} |
|
| 14 |
- |
|
| 15 |
-// CheckKernelVersion checks if current kernel is newer than (or equal to) |
|
| 16 |
-// the given version. |
|
| 17 |
-func CheckKernelVersion(k, major, minor int) bool {
|
|
| 18 |
- return kernel.CompareKernelVersion(*GetKernelVersion(), kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) > 0
|
|
| 19 |
-} |
| ... | ... |
@@ -12,12 +12,14 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/integration-cli/daemon" |
| 13 | 13 |
"github.com/docker/docker/integration-cli/request" |
| 14 | 14 |
"github.com/gotestyourself/gotestyourself/poll" |
| 15 |
+ "github.com/gotestyourself/gotestyourself/skip" |
|
| 15 | 16 |
"github.com/stretchr/testify/assert" |
| 16 | 17 |
"github.com/stretchr/testify/require" |
| 17 | 18 |
"golang.org/x/net/context" |
| 18 | 19 |
) |
| 19 | 20 |
|
| 20 | 21 |
func TestInspect(t *testing.T) {
|
| 22 |
+ skip.IfCondition(t, !testEnv.IsLocalDaemon()) |
|
| 21 | 23 |
defer setupTest(t)() |
| 22 | 24 |
d := newSwarm(t) |
| 23 | 25 |
defer d.Stop(t) |