Skip to content

Fix tests that look at 'Aliases'#3233

Closed
robmry wants to merge 1 commit intodocker:mainfrom
robmry:fix_tests_for_aliases
Closed

Fix tests that look at 'Aliases'#3233
robmry wants to merge 1 commit intodocker:mainfrom
robmry:fix_tests_for_aliases

Conversation

@robmry
Copy link
Copy Markdown
Contributor

@robmry robmry commented Mar 13, 2024

With Docker Engine 24.x, 25.x (and probably older versions), inspect output for NetworkSettings.Networks.<network>.Aliases includes the container's short-id.

(The short-id will be removed from 'Aliases' in API v1.45, in moby 26.0. So, this change will need to be reverted when docker-py is updated to that version.)

@robmry robmry self-assigned this Mar 13, 2024
Inspect output for 'NetworkSettings.Networks.<network>.Aliases'
includes the container's short-id (although it will be removed
in API v1.45, in moby 26.0).

Signed-off-by: Rob Murray <rob.murray@docker.com>
@robmry robmry force-pushed the fix_tests_for_aliases branch from d9c8672 to cb21af7 Compare March 13, 2024 14:54
@robmry robmry marked this pull request as draft March 13, 2024 16:08
@robmry
Copy link
Copy Markdown
Contributor Author

robmry commented Mar 13, 2024

It turns out that, while the docker <= 25.0 does include the short-id in inspect output for a running container, the result of docker-py's run() returns the state of the container after the 'create' but before the 'start' ... and that didn't include the short-id until docker 25.0.

Which explains why the tests had been passing ... and highlights an inadvertent change in docker 25.0.

(In 25.0, docker uses the API version to decide whether to include the short-id, but it doesn't precisely match the 24.0 behaviour. In 24.0, inspect after the container's started includes short-id, even once the container's been stopped again.)

We're not planning to fix that, as it's a bit subtle and inconsistent - but it means we need to include this change to the tests in the change that bumps docker-py to 25.0. (It'll still need to be reverted when we bump to 26.0 / API version 1.45, because the API is deliberately changed to exclude it in that version.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant