Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump default API version to 1.45 (Moby 26.0/26.1) #3261

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

thaJeztah
Copy link
Member

Update API version to the latest maintained release.

@thaJeztah
Copy link
Member Author

We still need to look at raising the minimum version, but I guess that can wait;

We should also start looking at raising this minimum, but I don't know if there's code specific in docker-py that handles differences between versions @milas ?

We're starting to deprecate old API versions, and the initial step is to disable (by default) API versions < 1.24. API 1.24 is the last version of the API before introduction of API version negotiation, so that's the version the CLI falls back to if it's unable to negotiate.

Copy link
Contributor

@krissetto krissetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
Copy link
Member Author

oh! some failure; let me see if it's related

@thaJeztah
Copy link
Member Author

Looks like it may be, and ISTR @robmry looked at some of that, but now wondering if it needs to be API-version aware (or the test rewritten to take both scenarios into account);

=================================== FAILURES ===================================
___________ ContainerCollectionTest.test_run_with_networking_config ____________
tests/integration/models_containers_test.py:136: in test_run_with_networking_config
    assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] \
E   AssertionError: assert ['hello'] == ['hello', '90b209030388']
E     Right contains one more item: '90b209030388'
E     Use -v to get more diff
_ ContainerCollectionTest.test_run_with_networking_config_only_undeclared_network _
tests/integration/models_containers_test.py:196: in test_run_with_networking_config_only_undeclared_network
    assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] == [attrs["Id"][:12]]
E   AssertionError: assert None == ['0ed603731bb5']
=========================== short test summary info ============================

@thaJeztah
Copy link
Member Author

☝️ I think this PR was related to that, but looks like that one wasn't merged; maybe it got included in another PR?

@krissetto
Copy link
Contributor

I remember seeing # In API version 1.45, the short-id will be removed..
Looks like that didn't happen? 🤔

@thaJeztah
Copy link
Member Author

Wondering if TEST_API_VERSION is passed through everywhere; I see at least one dockerfiles using DOCKER_API_VERSION (not TEST_.....) 🤔

@thaJeztah
Copy link
Member Author

I remember seeing # In API version 1.45, the short-id will be removed.. Looks like that didn't happen? 🤔

Oh; maybe it is removed, and that's the failure? AssertionError: assert None == ['0ed603731bb5']

But the test doesn't have a conditional on API version, so removing it would mean it'd fail on older API versions? 🤔

@krissetto
Copy link
Contributor

krissetto commented May 22, 2024

I remember seeing # In API version 1.45, the short-id will be removed.. Looks like that didn't happen? 🤔

Oh; maybe it is removed, and that's the failure? AssertionError: assert None == ['0ed603731bb5']

But the test doesn't have a conditional on API version, so removing it would mean it'd fail on older API versions? 🤔

nah, the test seems to be assert ['hello'] == ['hello', '90b209030388'], indicating it's still present (?)

@krissetto
Copy link
Contributor

i don't see it when running a docker inspect locally though, with engine and client at 26.0.1

@thaJeztah
Copy link
Member Author

Tried updating the test, but now getting

=================================== FAILURES ===================================
___________ ContainerCollectionTest.test_run_with_networking_config ____________
tests/integration/models_containers_test.py:136: in test_run_with_networking_config
    assert (attrs['NetworkSettings']['Networks'][net_name]['Aliases']
E   AssertionError: assert ['hello'] is None
_ ContainerCollectionTest.test_run_with_networking_config_only_undeclared_network _
tests/integration/models_containers_test.py:202: in test_run_with_networking_config_only_undeclared_network
    assert attrs['NetworkSettings']['Networks'][net_name]['DNSNames'] \
E   AssertionError: assert None == ['hello', 'e293f5effd7e']

So, looks like that wasn't right 🙈

@thaJeztah
Copy link
Member Author

Getting closer; only one failure remaining;

___________ ContainerCollectionTest.test_run_with_networking_config ____________
tests/integration/models_containers_test.py:136: in test_run_with_networking_config
    assert (attrs['NetworkSettings']['Networks'][net_name]['Aliases']
E   AssertionError: assert ['hello'] is None

@krissetto
Copy link
Contributor

what is our expectation here? meaning, are the tests "wrong" or is the engine's behavior slightly out-of-spec from what we were expecting?

@thaJeztah
Copy link
Member Author

Trying to figure that out honestly; thought let me update the test to see what it actually sees, then check with @robmry and @akerouanton if this is the expected result here. 😂

@thaJeztah
Copy link
Member Author

LOL, and now it's back to;

___________ ContainerCollectionTest.test_run_with_networking_config ____________
tests/integration/models_containers_test.py:138: in test_run_with_networking_config
    assert attrs['NetworkSettings']['Networks'][net_name]['DNSNames'] \
E   AssertionError: assert None == ['hello', '34fe1fead4b8']

Is there some race condition? Or did I just broke it again? (the "expected" vs "actual" part is also confusing me for sure here 😂 )

@thaJeztah thaJeztah force-pushed the bump_engine_versions branch 2 times, most recently from a94f0ac to 2722873 Compare May 22, 2024 16:21
@milas
Copy link
Contributor

milas commented May 22, 2024

Unfortunately, I don't actually know anything about version negotiation in the Python code.

However, I would imagine it's mostly only ever been exercised in the other direction, e.g. to avoid sending a newly added field/query param to an older daemon.

The test logic might also be more for broad test suite compatibility rather than comprehensive matrix coverage.

(That is, I'm suggesting it's not unreasonable to be somewhat suspicious of both the library code & tests in this regard.)

@thaJeztah
Copy link
Member Author

Oh! Looks like it's green now! Guess it's time for me to squash commits, and to discuss if these changes are all correct with the networking folks 🥹

Comment on lines +193 to 197
# Aliases no longer include the container's short-id in API v1.45.
assert (attrs['NetworkSettings']['Networks'][net_name]['Aliases']
is None)
assert (attrs['NetworkSettings']['Networks'][net_name]['DriverOpts']
is None)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I think I tried adding an assertion for DNSNames here, but that didn't work; wondering if something needs to be added to make that field being propagated here, and if that should be checked for.

For reference, here's what inspecting a container created with similar options looks like (Aliases is null, and both the short-ID and custom hello alias are shown in DNSNames);

docker inspect --format='{{json .NetworkSettings.Networks }}' hello | jq .
{
  "foo": {
    "IPAMConfig": null,
    "Links": null,
    "Aliases": null,
    "MacAddress": "02:42:ac:15:00:02",
    "NetworkID": "d527fac86492c97c660830566d00d410281b8b67cc2f9d85fc60229d5d5d76ee",
    "EndpointID": "4309540d4d79c6fbd21e883c867657bd5550b54fe55d1a623d9858bbf1846ee5",
    "Gateway": "172.21.0.1",
    "IPAddress": "172.21.0.2",
    "IPPrefixLen": 16,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "DriverOpts": null,
    "DNSNames": [
      "hello",
      "e9e430344c84"
    ]
  }
}

- Update API version to the latest maintained release.
0 Adjust tests for API 1.45

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah self-assigned this Oct 27, 2024
@thaJeztah thaJeztah merged commit bb0edd1 into docker:main Oct 27, 2024
11 checks passed
@thaJeztah thaJeztah deleted the bump_engine_versions branch October 27, 2024 16:09
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.

3 participants