Commit Graph

6064 Commits

Author SHA1 Message Date
Paweł Gronowski
77bebe7030 Merge pull request #52096 from deahtstroke/50159-migrate-TestAPIStatsNetworkStats-from-integration-cli
integration/container: Migrate TestAPIStatsNetworkStats to integratio…
2026-06-18 12:54:22 +02:00
Daniel Villavicencio
47f6e9248b integration/container: migrate TestAPIStatsNetworkStats to integration suite
Signed-off-by: Daniel Villavicencio <dvm3099@pm.me>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-18 10:56:51 +02:00
5h4rk-lab
c8f44969df integration: migrate TestAPICreateDeletePredefinedNetworks from integration-cli
Signed-off-by: Go Charan Kilaru <sharkmagic07@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-18 02:12:52 +02:00
Paweł Gronowski
e7ac69f482 integration-cli: Migrate restart suite
Migrate non-redundant `DockerCLIRestartSuite` cases to modern integration tests:

- `TestRestartStoppedContainer` -> `TestContainerRestartStoppedContainer`
- `TestRestartWithVolumes` -> `TestContainerRestartWithVolumes`
- `TestRestartContainerSuccess` -> `TestContainerRestartPolicyAfterProcessExit/direct-process-exit`
- `TestRestartPolicyAfterRestart` -> `TestContainerRestartPolicyAfterProcessExit/after-manual-restart`
- `TestRestartWithPolicyUserDefinedNetwork` -> `TestContainerRestartPolicyUserDefinedNetwork`

Drop redundant deprecated cases:

- `TestRestartRunningContainer`
  covered by `TestWaitRestartedContainer`.
- `TestRestartPolicyNO`, `TestRestartPolicyAlways`, `TestRestartPolicyOnFailure`
  covered by modern create/restart-policy tests.
- `TestRestartAutoRemoveContainer`
   covered by `TestContainerWithAutoRemoveCanBeRestarted`.
- `TestRestartDisconnectedContainer`
  low-value adjacent coverage already exercised by networking restart tests.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-17 18:43:05 +02:00
Sebastiaan van Stijn
b2b1e91323 Merge pull request #50631 from carsontham/migrate-test-container-api-stop
integration-cli: migrated test TestContainerAPIStop
2026-06-16 19:54:13 +02:00
Sebastiaan van Stijn
532e50b773 Merge pull request #50494 from Abubacarr075/50159-migrate-test-api-images
migrate TestAPIImagesSearchJSONContentType to integration
2026-06-16 19:05:07 +02:00
carsontham
cfe61f52d6 migrated TestContainerAPIStop
This test was already migrated as integration/container.TestStopContainerWithTimeout

Signed-off-by: carsontham <carsontham@outlook.com>
2026-06-16 17:45:17 +02:00
Sebastiaan van Stijn
c891cf6dcb Merge pull request #52858 from vvoland/fix-flaky-windows
integration-cli: Migrate TestContainersAPICreateMountsCreate
2026-06-16 17:32:29 +02:00
Abubacarr Ceesay
269c1eda0f migrate TestAPIImagesSearchJSONContentType to integration
Migrate test api images search json content type from integration cli to integration tests

Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-16 17:14:22 +02:00
Paweł Gronowski
cfe0e72854 integration-cli: Migrate TestContainersAPICreateMountsCreate
Move the useful Mounts API create coverage out of integration-cli and
into the container integration tests that own the behavior.

Add volume mount inspect assertions to TestContainerVolumeAnonymous for
destination normalization, read-only named volumes, explicit driver
configuration, and NoCopy mounts.

Add a focused bind mount inspect test for read-only bind mounts and
shared propagation.

Do not port the full integration-cli matrix. Existing integration tests
already cover anonymous volume creation and labeling, anonymous volume
removal with RemoveVolumes, and generic bind propagation handling.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 21:10:34 +02:00
Paweł Gronowski
b764e28d55 integration-cli/container: Rewrite on-failure restart tests
Replace flaky legacy CLI restart-policy tests with container API
integration coverage.

The CLI tests poll inspect output after short-lived detached containers
exit, which can observe transient daemon monitor state while cleanup or
restart-policy handling is still settling.

On Windows this can race a manual restart against an `on-failure:3`
container that has not exhausted its automatic retries.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 19:35:31 +02:00
Paweł Gronowski
29f6cd5c90 Merge pull request #41963 from thaJeztah/prefix_slash
testing: refactor uses of "getPrefixAndSlashFromDaemonPlatform()"
2026-06-11 17:33:42 +02:00
Cory Snider
1dd67f8dea integration-cli: get container id from stdout only
TestDaemonRestartWithNames in the DockerDaemonSuite has been broken
since commit 72ec7cd6cc. The test takes
the combined output of a `docker run` command as the ID of the created
container. This works fine so long as the command emits no warnings,
otherwise it will corrupt the ID that the test captures. Modify the test
to read the ID from the command's stdout to make the test robust to
warnings being printed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2026-06-10 15:57:48 -04:00
Paweł Gronowski
b571092d29 integration-cli: Deflake TestDockerCLICpSuite
The cp integration fixture only needs a stopped container with prepared
filesystem content.

Running the container detached and immediately calling `docker wait`
adds an extra daemon wait request that can race with short-lived fixture
containers and fail before the copy behavior is exercised.

Run the fixture command in the foreground and capture the resulting
container ID with a cidfile so the container remains available for later
cp assertions without the separate wait endpoint.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-29 19:25:59 +02:00
Sebastiaan van Stijn
1cba169996 integration-cli: remove some redundant fmt.Sprintf()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-05-18 23:21:46 +02:00
Sebastiaan van Stijn
f806aacca8 testing: refactor uses of "getPrefixAndSlashFromDaemonPlatform()"
Implement a `dPath()` utility function that converts paths to Windows paths
(add `c:` drive-letter, and convert to backslashes) if the daemon is running
on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-05-18 23:21:39 +02:00
Paweł Gronowski
160a0112e1 integration-cli: Deflake TestBuildEmitsEvents
The test queried `docker events` without `--until` and relied on a 300ms
timeout to collect output.

On slow CI, events may not stream back within that window, resulting in
empty stdout and assertion failures.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-14 14:07:40 +02:00
Sahana Narasipura Vasudevarao
07a5e924ce Fix typos and misspellings in comments, tests, and docs
Signed-off-by: Sahana Narasipura Vasudevarao <nvsahanarao@gmail.com>
2026-04-02 14:20:22 -07:00
Sebastiaan van Stijn
210cdcbd46 daemon/server/router: fix "no stream selected" error and status
Tweak the wording, and make sure we return a 400 status, not a 500

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-03 21:53:23 +01:00
Rob Murray
1f71f2217d Merge pull request #51837 from 2003Aditya/TestSwarmCAHash
migrate TestAPISwarmCAHash to Integration Test
2026-02-15 11:04:30 +00:00
Aditya Mishra
b7a404d94d migrate TestSwarmCAHash to Integration Test
Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2026-02-14 23:21:42 +05:30
Sebastiaan van Stijn
21d383fca5 modernize: waitgroup
Update some remaining waitgroups;

    go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -waitgroup -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-13 18:49:51 +01:00
Cory Snider
eb0a1bc455 integration: run more Buildkit tests on Windows
Buildkit was enabled for Windows engines when using containerd
snapshotters in commit a9ec07a005.
Buildkit's integration tests are run on Windows in CI, but a handful of
daemon integration tests are still skipped. Change those tests to only
skip on Windows when the daemon under test is not using containerd
snapshotters.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2026-02-06 15:52:46 -05:00
Sebastiaan van Stijn
f23e824d75 Merge pull request #51865 from yudnk/50159-migrate_test_container_api_post_container_stop
migrate TestContainerAPIPostContainerStop to integration
2026-01-21 13:48:43 +01:00
Sebastiaan van Stijn
1b5b00c98c fix grammar: user defined / user specified -> user-(defined|specified)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-19 13:43:06 +01:00
Yudai Nakakubo
ef5287fb08 migrate TestContainerAPIPostContainerStop to integration
Migrates:

- TestContainerAPIPostContainerStop

Signed-off-by: Yudai Nakakubo <nyggl4dev@gmail.com>
2026-01-17 11:59:52 +09:00
Rob Murray
911d311adf Merge pull request #51585 from 2003Aditya/TestAPIOptionsRoute
migrate TestAPIOptionsRoute to integration test
2026-01-07 15:33:27 +00:00
Aditya Mishra
ae4c17fdb7 migrate TestAPIImageImportBadSrc to integration test
Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2025-12-26 00:40:48 +05:30
Aditya Mishra
93afda3670 migrate TestAPINetworkInspectWithScope to integration test
Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2025-12-26 00:27:41 +05:30
Sebastiaan van Stijn
7239c72eca remove uses of deprecated go-archive consts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-19 17:51:03 +01:00
Sebastiaan van Stijn
1f498c5ff0 fix linting issues
Some false positives from gosec (G602: slice index out of range)

    integration-cli/daemon/daemon.go:109:1: deprecatedComment: `Deprecated: ` notices should be in a dedicated paragraph, separated from the rest (gocritic)
    // Deprecated: use cli.WaitCmd instead
    ^
    integration-cli/docker_cli_build_test.go:562:3: dupOption: function argument `build.WithFile("test_file3", "test3")` is duplicated (gocritic)
            build.WithFile("test_file3", "test3"),
            ^
    integration-cli/docker_utils_test.go:250:1: deprecatedComment: `Deprecated: ` notices should be in a dedicated paragraph, separated from the rest (gocritic)
    // Deprecated: use cli.WaitFor
    ^
    daemon/libnetwork/ipams/defaultipam/address_space.go:45:39: G602: slice index out of range (gosec)
            if predefined[j].Overlaps(predefined[i].Base) {
                                                ^
    daemon/libnetwork/ipams/defaultipam/address_space.go:49:29: G602: slice index out of range (gosec)
            predefined[j] = predefined[i]
                                      ^
    daemon/libnetwork/libnetwork_linux_test.go:1492:9: G602: slice index out of range (gosec)
            sboxes[thd-1], err = controller.NewSandbox(context.Background(), fmt.Sprintf("%drace", thd))
                  ^
    daemon/libnetwork/networkdb/cluster_test.go:111:21: G602: slice index out of range (gosec)
                mean, stdev := nf[0], nf[1]
                                 ^
    daemon/libnetwork/osl/interface_linux.go:586:54: G602: slice index out of range (gosec)
                log.G(ctx).WithField("portState", stateFileContent[0]).Debug("waiting for bridge port to be forwarding")
                                                                  ^
    daemon/libnetwork/osl/interface_linux.go:594:32: G602: slice index out of range (gosec)
            "portState": stateFileContent[0],
                                         ^
    daemon/libnetwork/portallocator/osallocator_linux_test.go:358:13: G602: slice index out of range (gosec)
            if payload[0] != 0x1 {
                      ^
    daemon/libnetwork/portallocator/osallocator_linux_test.go:359:68: G602: slice index out of range (gosec)
                readCh <- fmt.Errorf("expected payload 0x1, but got %x", payload[0])
                                                                                ^
    daemon/logger/gelf/gelf_test.go:197:9: nilness: impossible condition: nil != nil (govet)
        if err != nil {
               ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-16 16:55:20 +01:00
Paweł Gronowski
1489cb3ae0 Merge pull request #51722 from vvoland/modernize
Modernize Go code
2025-12-16 12:38:36 +00:00
Rob Murray
bdda339294 Merge pull request #51574 from 2003Aditya/TestAPINetworkInspectWithScope
migrate TestAPINetworkInspectWithScope to integration test
2025-12-15 20:53:15 +00:00
Paweł Gronowski
62ed24a87c modernize: Use slices.Contains
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
3df05205f4 modernize: Use range int
Added in Go 1.22

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
39c19d9161 modernize: Use fmt.Appendf
Added in Go 1.19

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
a25907b485 modernize: Prefer strings.SplitSeq instead of Split
Avoids extra allocations. Added in Go 1.24.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Aditya Mishra
29d5098ffd migrate TestAPINetworkInspectWithScope to integration test
Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2025-12-13 23:24:31 +05:30
Sebastiaan van Stijn
565f7dce18 integration-cli: TestUserDefinedNetworkAlias: adjust for API versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-10 01:51:26 +01:00
Sebastiaan van Stijn
93eb7962dc integration-cli: TestUserDefinedNetworkAlias: replace deprecated utils
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-10 01:51:26 +01:00
Sebastiaan van Stijn
83f17f77cf integration-cli: adjust some tests for API-specific event-types
Image create events were added in API 1.46, and filtered out in older
API versions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-10 01:51:26 +01:00
Sebastiaan van Stijn
35f1250685 integration-cli: use event-consts in some tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-10 01:51:23 +01:00
Sebastiaan van Stijn
33eb3b8d78 integration-cli: TestEventsFilterType: remove test for "build" events
Commit 6aea8c2591 updated this part of the
test to account for BuildKit now being used as default, which doesn't use
regular containers to "commit" to an image, and therefore doesn't produce
events as part of the build.

However, it changed it to filter for `build` type events, which .. don't
exist. The test passed because it only checked for number of events produced,
which is approximated by checking the number of lines in the output. In
this case, the output would be empty, so "events" was a slice of strings
with length 1; an empty string.

Given that BuildKit doesn't produce meaningful events to test for, we could
either disable BuildKit, to test the legacy builder, or just remove this
part of the test. Let's do the latter.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-10 01:50:45 +01:00
Sebastiaan van Stijn
fcb23060fc integration-cli: rewrite some tests depending on intermediate images
These tests used intermediate images (as produced by the classic builder)
as part of the test. When using BuildKit, such images are not produced,
and will only be in the build-cache.

From the tests, it looks like the extra checks were not critical to
verify the behavior, so let's simplify them to not depend on this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-09 17:04:49 +01:00
Sebastiaan van Stijn
751a6f9f33 integration-cli: improve TestBuildNoNamedVolume
Make sure the error is the one we expected, and slightly clarify
the behavior (named volumes not having a meaning in VOLUME, so will
be used as-is).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-09 17:01:53 +01:00
Sebastiaan van Stijn
5152c7c3ef integration-cli: DockerCLIBuildSuite: use more unique names for images
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-09 17:00:21 +01:00
Sebastiaan van Stijn
a39e866aa8 integration-cli: rename var that shadowed package-level const
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-09 17:00:21 +01:00
Aditya Mishra
87583c9029 integration: migrate TestAPIImagesSizeCompatibility to integration test
Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2025-11-29 00:28:44 +05:30
Rob Murray
5512eea3d0 Merge pull request #51559 from 2003Aditya/TestAPIImagesSaveAndLoad
migrate TestAPIImagesSaveAndLoad to integration test
2025-11-26 12:11:14 +00:00
Rob Murray
84a251d039 Allow configured address with no configured subnet
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-24 14:14:27 +00:00