6038 Commits

Author SHA1 Message Date
Paweł Gronowski
a470ad7ffd Merge pull request #50390 from Abubacarr075/50159-migrate-api-images-history-cli-tests-to-integration
migrate test api images history integration cli test to integration test
2025-07-14 12:26:31 +02:00
Sebastiaan van Stijn
a327a9f341 integration-cli: fix flaky TestRestartStoppedContainer
This test was failing frequently on Windows, waiting for the state
of the container to be "running" after restarting, however, this
would race because the command of the container was very short-lived;

    === Failed
    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIRestartSuite/TestRestartStoppedContainer (37.00s)
        docker_cli_restart_test.go:42: assertion failed: error is not nil: condition ""true" == "false"" not true in time (20s)

Ironically, that check was added in 48ccdd46ae
to make the test less flaky.

This patch takes the approach from TestRestartRunningContainer, which had
similar issues on Windows that were addressed in bae22d167c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:45:27 +02:00
Sebastiaan van Stijn
1c8b09ccf6 integration-cli: TestDockerNetworkHostModeUngracefulDaemonRestart start, not restart
This test was testing a non-gracceful kill od the daemon, after which it
started it again, however `d.Stop()` would log that the daemon wasn't running,
which is expected, so let's reduce noise;

    docker_cli_network_unix_test.go:1143: [dadd2ae3b638b] daemon is not started

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:35:51 +02:00
Abubacarr Ceesay
669163c416 remove test api images history integration cli test suite
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 19:03:19 +02:00
Sebastiaan van Stijn
ac9d5a6068 integration-cli: TestPullFailsWithAlteredLayer: use OCI manifest
The OCI types should be able to unmarshal the image manifest (regardless
if it was created from the legacy distribution types or otherwise), so
we can drop the use of the legacy distribution types here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:56:35 +02:00
Sebastiaan van Stijn
fd47ccef7b integration-cli: TestPullFailsWithAlteredManifest: use OCI manifest
The OCI types should be able to unmarshal the image manifest (regardless
if it was created from the legacy distribution types or otherwise), so
we can drop the use of the legacy distribution types here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:52:48 +02:00
Sebastiaan van Stijn
4e818970e2 integration-cli: TestPullManifestList: use OCI media-types
This test is verifying that push/pull works; current versions of the registry
used should support both the legacy (docker distribution) and OCI media-types,
so let's use the OCI types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:48:48 +02:00
Sebastiaan van Stijn
f6ef56a0bc integration-cli: TestPullManifestList: rewrite using OCI types
Trying to reduce the places where we depend on the legacy distribution
dependency. For this test, we used it to generate the JSON for a manifest-list,
which we can do with the OCI types as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:44:50 +02:00
Sebastiaan van Stijn
033750cf80 image/tarexport: remove suport for loading v0/v1 images
This removes the tarexporter.legacyLoadImage method and related helpers.
This functionality was added in 01ba0a935b
(docker v1.10), which introduced the new content-addressable image
format; this code provided backward-compatibility with older archives
which contained v0/v1 images.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:48:52 +02:00
Rob Murray
242916b3f9 Merge pull request #45415 from thaJeztah/test_TestPushToCentralRegistryUnauthorized
integration-cli: debug TestPushToCentralRegistryUnauthorized
2025-07-03 14:16:56 +01:00
Sebastiaan van Stijn
8dbe0f45a9 integration-cli: debug TestPushToCentralRegistryUnauthorized
Seeing some test-failures, which could be due to changes on Docker Hub

    === Failed
    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIPushSuite/TestPushToCentralRegistryUnauthorized (51.08s)
        docker_cli_push_test.go:229: assertion failed: strings.Contains(out, "Retrying") is true

    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIPushSuite (101.49s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 15:44:52 +02:00
Sebastiaan van Stijn
a30b63eafc integration-cli: remove uses of deprecated dockerCmdWithResult utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 13:21:30 +02:00
Matthieu MOREL
381d9d0723 fix use-errors-new from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Rob Murray
f9e6f25677 Merge pull request #50196 from robmry/fix_TestDaemonRestartRestoreBridgeNetwork
Fix flaky test TestDaemonRestartRestoreBridgeNetwork
2025-06-13 12:21:19 +01:00
Rob Murray
aac0260d21 Fix flaky test TestDaemonRestartRestoreBridgeNetwork
It checked for "Bind for 0.0.0.0:80 failed: port is already
allocated". But, since commit d662091 ("portallocator: always
check for ports allocated for 0.0.0.0/::"), the message is
sometimes about ":::80".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-13 10:53:22 +01:00
Matthieu MOREL
6d737371b8 fix comparison rule from errorlint
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-13 08:26:56 +00:00
Rob Murray
6b9bd0a800 Merge pull request #50144 from thaJeztah/rm_import_aliases
all: remove redundant import-aliases for "go-winio"
2025-06-11 11:25:05 +01:00
Paweł Gronowski
e84353ebbd Merge pull request #50135 from thaJeztah/inspect_no_omitempty
api: image inspect: add back fields that did not omitempty
2025-06-11 08:58:14 +00:00
Matthieu MOREL
b8a4f6534f fix stringsCompare and stringConcatSimplify from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
a62de57aa1 fix sprintfQuotedString from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
bc9ec5fc02 fix emptyStringTest from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
9b5d8cd186 fix thelper linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-05 21:42:05 +00:00
Sebastiaan van Stijn
bd20bfdc41 all: remove redundant import-aliases for "go-winio"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-05 12:11:30 +02:00
Sebastiaan van Stijn
f85394dd5d api: image inspect: add back fields that did not omitempty
commit 4dc961d0e9 removed deprecated
fields from the image inspect response for API v1.50 and up. As
part of that change, it changed the type used for the Config field
to use the docker image spect structs, which embeds the OCI image
spec structs.

While the OCI image spect struct contains the same fields as we
used before, those fields also have "omitempty" set, which means
they are now omitted when empty.

We should probably consider deprecating that behavior in the API,
and call out that these fields are omitted if not set, but in the
meantime, we can add them back with their default (zero) value.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-04 18:01:19 +02:00
Sebastiaan van Stijn
a4b0d32fa6 integration-cli: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:13 +02:00
Matthieu MOREL
528f2284ee integration-cli: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:40:06 +00:00
Sebastiaan van Stijn
4dc961d0e9 image-inspect: remove Config fields that are not part of the image
commit af0cdc36c7 marked these fields as
deprecated and to be removed in API v1.47 (which was targeted for v28.0).
We shipped v1.47 with the v27.2 release, but did not yet remove the erroneous
fields, so the version to deprecate was updated to v1.48 through
3df03d8e66

This patch removes fields that are not part of the image by replacing the
type with the Config struct from the docker image-spec.

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.50/images/alpine/json | jq .Config
    {
      "Env": [
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      ],
      "Cmd": [
        "/bin/sh"
      ]
    }

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.49/images/alpine/json | jq .Config
    {
      "Hostname": "",
      "Domainname": "",
      "User": "",
      "AttachStdin": false,
      "AttachStdout": false,
      "AttachStderr": false,
      "Tty": false,
      "OpenStdin": false,
      "StdinOnce": false,
      "Env": [
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      ],
      "Cmd": [
        "/bin/sh"
      ],
      "Image": "",
      "Volumes": null,
      "WorkingDir": "",
      "Entrypoint": null,
      "OnBuild": null,
      "Labels": null
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 17:14:37 +02:00
Sebastiaan van Stijn
7148c6a5f5 Merge pull request #42300 from thaJeztah/carry_39384_remove_v2_schema1_push
Remove support for pulling v2 schema1
2025-05-21 23:43:41 +02:00
Sebastiaan van Stijn
0b1c7a8306 api/types: move ServiceUpdateOptions to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 16:30:33 +02:00
Sebastiaan van Stijn
31d62930f7 api/types: move ServiceCreateOptions to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 16:30:31 +02:00
Sebastiaan van Stijn
5ad0867236 api/types: move TaskListOptions to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 16:30:03 +02:00
Sebastiaan van Stijn
f008d85edc api/types: move NodeListOptions, NodeRemoveOptions to types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 13:43:16 +02:00
Sebastiaan van Stijn
b13528522a api/types: move ServiceListOptions, ServiceInspectOptions to types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 13:41:59 +02:00
Sebastiaan van Stijn
7130cd4f16 Remove DockerSchema1RegistrySuite schema 2 version 1 tests
Also remove the DOCKER_ALLOW_SCHEMA1_PUSH_DONOTUSE from Jenkins

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 18:00:06 +02:00
Matthieu MOREL
205ba05feb fix usestdlibvars
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-15 18:24:58 +02:00
Sebastiaan van Stijn
3bbdda696d use container.ContainerState consts in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-13 15:03:34 +02:00
Rob Murray
37259540e9 Remove/replace integration-cli tests that use iptables directly
In preparation for testing with an nftables backend.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-12 17:51:59 +01:00
Sebastiaan van Stijn
d1c58bdbbe integration-cli: remove/rename err-returns and remove naked returns
Prevent accidentally shadowing these errors, which are used in defers, and
remove naked returns.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:08 +02:00
Matthieu MOREL
b0711d5fe9 fix(QF1001): Apply De Morgan’s law
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:16:44 +02:00
Sebastiaan van Stijn
c690e0076a use consts for health-status in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:05:26 +02:00
Sebastiaan van Stijn
eede75c9d4 testing: remove some defer cleanup in favor of test.Cleanup()
gotest.tools v3.0.1 and up support Go's native test.Cleanup(), which
means that manually calling the cleanup functions in a defer is no
longer needed.

Some of these could probably be replaced by Go's native `t.TempDir()`,
but keeping that for a follow-up exercise.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-19 16:35:24 +02:00
Sebastiaan van Stijn
fd550344b1 vendor: github.com/moby/go-archive v0.1.0
full diff: https://github.com/moby/go-archive/compare/21f3f3385ab7...v0.1.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-16 13:00:13 +02:00
Paweł Gronowski
fb2983ab0d Merge pull request #49677 from vvoland/integration-cli-bump-cli
integration-cli: Update default CLI version to v18.06.3-ce
2025-04-11 10:32:36 +00:00
Sebastiaan van Stijn
e2b95a9525 Merge pull request #49770 from dmcgowan/containerd-registry-error-handling
Add registry error handling for push and pull
2025-04-10 21:32:56 +02:00
Rob Murray
3fc5bfd565 Merge pull request #49778 from robmry/fix_delete_legacy_link
Fix removal of legacy links
2025-04-10 15:16:00 +01:00
Rob Murray
4d35864c3d Fix removal of legacy links
It's possible to remove a legacy link from running containers.
When that happens, the Sandbox's Endpoints are removed and
re-added.

Since commit 65120d5 ("Create bridge veth in container netns")
the veth device has been created in the container's netns. When
that happens, a flag is set on the Endpoint to note that it
does not need to be moved into the netns.

But, during the Leave/Join (Sandbox.Refresh) the veth is moved
out of the netns. So, clear the flag during the Leave, to note
that it needs to be moved back in during the Join.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-10 14:22:40 +01:00
Sebastiaan van Stijn
91ba210bc8 Merge pull request #49666 from thaJeztah/legacy_errors
api, client: produce human-readable errors for unsupported API versions (< v1.24)
2025-04-10 12:08:56 +02:00
Paweł Gronowski
5f9d99b4cc integration-cli/swarm: Update to use gotest.tools
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-10 11:39:18 +02:00
Paweł Gronowski
ea6c76ee03 integration-cli/TestSwarmInit: Skip failing part on CLI after 18.06
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-10 11:39:16 +02:00
Paweł Gronowski
fab94808f5 integration-cli: Update default CLI version to v18.06.3-ce
This updates the Docker CLI version used for integration-cli tests from
v17.06.2-ce to v18.06.3-ce.

v18.06 is the first one that supports enabling BuildKit.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-10 11:39:13 +02:00