test/integration: don't check for deprecated Networks field#3362
test/integration: don't check for deprecated Networks field#3362thaJeztah merged 1 commit intodocker:mainfrom
Conversation
|
Ah, fun; probably test-certs / fixtures expired? Or something else? |
ff8ebfc to
13887ba
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR updates integration tests to check for the Networks field in the correct location after the deprecation of Spec.Networks in the Docker API. The tests are updated to check Spec.TaskTemplate.Networks instead of Spec.Networks, and network configurations are moved from service creation parameters to the TaskTemplate object.
Key changes:
- Network configurations moved from
create_service()parameters toTaskTemplateconstructor - Assertions updated to check
svc_info['Spec']['TaskTemplate']['Networks']instead ofsvc_info['Spec']['Networks']
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| assert new_index > version_index | ||
|
|
||
| task_tmpl = docker.types.TaskTemplate( | ||
| container_spec, networks=[net1['Id']] |
There was a problem hiding this comment.
Extra space before 'networks' parameter. Should be single space after comma.
| container_spec, networks=[net1['Id']] | |
| container_spec, networks=[net1['Id']] |
These tests depended on the deprecated Spec.Networks field, which
is no longer part of current API versions, causing the test to
fail;
=================================== FAILURES ===================================
_____________ ServiceTest.test_create_service_with_custom_networks _____________
tests/integration/api_service_test.py:379: in test_create_service_with_custom_networks
assert 'Networks' in svc_info['Spec']
E AssertionError: assert 'Networks' in {'Labels': {}, 'Mode': {'Replicated': {'Replicas': 1}}, 'Name': 'dockerpytest_a538894175d07404', 'TaskTemplate': {'Con...pec': {'Command': ['true'], 'Image': 'alpine:3.10', 'Isolation': 'default'}, 'ForceUpdate': 0, 'Runtime': 'container'}}
____________ ServiceTest.test_update_service_with_defaults_networks ____________
tests/integration/api_service_test.py:1128: in test_update_service_with_defaults_networks
assert 'Networks' in svc_info['Spec']
E AssertionError: assert 'Networks' in {'Labels': {}, 'Mode': {'Replicated': {'Replicas': 1}}, 'Name': 'dockerpytest_6d8e30f359c0f5e', 'TaskTemplate': {'Cont...pec': {'Command': ['true'], 'Image': 'alpine:3.10', 'Isolation': 'default'}, 'ForceUpdate': 0, 'Runtime': 'container'}}
_____________ ServiceTest.test_update_service_with_network_change ______________
tests/integration/api_service_test.py:1333: in test_update_service_with_network_change
assert 'Networks' in svc_info['Spec']
E AssertionError: assert 'Networks' in {'Labels': {}, 'Mode': {'Replicated': {'Replicas': 1}}, 'Name': 'dockerpytest_d4e23667cdbaf159', 'TaskTemplate': {'Con... {'Command': ['echo', 'hello'], 'Image': 'busybox', 'Isolation': 'default'}, 'ForceUpdate': 0, 'Runtime': 'container'}}
------- generated xml file: /src/bundles/test-docker-py/junit-report.xml -------
=========================== short test summary info ============================
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
13887ba to
b520fb8
Compare
|
Looks like it did! Surprised CI didn't bart about it; usually it's picky in Python w.r.t. white-spaces and formatting. |
|
Not sure that's really an error in this case, just unneeded white space |
|
Yeah; I'm too used to Go just formatting my stuff! 😂 Either way; it's green; I'll bring this one in! |
… TaskTemplate structure as per the changes in docker 29.0 and metioned/explained at docker/docker-py#3362
These tests depended on the deprecated Spec.Networks field, which is no longer part of current API versions, causing the test to fail;