Skip to content

Conversation

@thaJeztah
Copy link
Member

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 ============================

@thaJeztah
Copy link
Member Author

Ah, fun; probably test-certs / fixtures expired? Or something else?

==================================== ERRORS ====================================
_________ ERROR at setup of BuildTest.test_build_container_with_target _________
/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:464: in _make_request
    self._validate_conn(conn)
/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:1093: in _validate_conn
    conn.connect()
/usr/local/lib/python3.12/site-packages/urllib3/connection.py:790: in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
/usr/local/lib/python3.12/site-packages/urllib3/connection.py:969: in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
/usr/local/lib/python3.12/site-packages/urllib3/util/ssl_.py:480: in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
/usr/local/lib/python3.12/site-packages/urllib3/util/ssl_.py:524: in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
/usr/local/lib/python3.12/ssl.py:455: in wrap_socket
    return self.sslsocket_class._create(
/usr/local/lib/python3.12/ssl.py:1041: in _create
    self.do_handshake()
/usr/local/lib/python3.12/ssl.py:1319: in do_handshake
    self._sslobj.do_handshake()
E   ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: invalid CA certificate (_ssl.c:1010)

During handling of the above exception, another exception occurred:
/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self._make_request(
/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:488: in _make_request
    raise new_e
E   urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: invalid CA certificate (_ssl.c:1010)

@thaJeztah thaJeztah force-pushed the integration_deprecated_network branch 3 times, most recently from ff8ebfc to 13887ba Compare October 17, 2025 11:16
@thaJeztah thaJeztah marked this pull request as ready for review October 17, 2025 13:13
@vvoland vvoland requested a review from Copilot October 17, 2025 13:41
Copy link
Contributor

@vvoland vvoland left a comment

Choose a reason for hiding this comment

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

SGTM (but requesting a Copilot review just in case it's able to spot something)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 to TaskTemplate constructor
  • Assertions updated to check svc_info['Spec']['TaskTemplate']['Networks'] instead of svc_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']]
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Extra space before 'networks' parameter. Should be single space after comma.

Suggested change
container_spec, networks=[net1['Id']]
container_spec, networks=[net1['Id']]

Copilot uses AI. Check for mistakes.
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>
@thaJeztah thaJeztah force-pushed the integration_deprecated_network branch from 13887ba to b520fb8 Compare October 17, 2025 14:16
@thaJeztah
Copy link
Member Author

Looks like it did! Surprised CI didn't bart about it; usually it's picky in Python w.r.t. white-spaces and formatting.

@vvoland
Copy link
Contributor

vvoland commented Oct 17, 2025

Not sure that's really an error in this case, just unneeded white space

@thaJeztah
Copy link
Member Author

Yeah; I'm too used to Go just formatting my stuff! 😂

Either way; it's green; I'll bring this one in!

@thaJeztah thaJeztah merged commit 65f7f0c into docker:main Oct 17, 2025
11 checks passed
@thaJeztah thaJeztah deleted the integration_deprecated_network branch October 17, 2025 14:53
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.

2 participants