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

tests/integration: update some tests for updated error-messages #3165

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Aug 14, 2023

I was in the process of cleaning up some error-messages in moby/moby#46213 (likely will be moved to a separate PR), and it looks like the docker-py tests were depending on strings that will be removed;

=================================== FAILURES ===================================
_____________ CreateContainerTest.test_create_with_restart_policy ______________
tests/integration/api_container_test.py:126: in test_create_with_restart_policy
    assert 'You cannot remove ' in err
E   AssertionError: assert 'You cannot remove ' in 'cannot remove container d11580f6078108691096ec8a23404a6bda9ad1d1b2bafe88b17d127a67728833: container is restarting: stop the container before removing or force remove'
____________________ ErrorsTest.test_api_error_parses_json _____________________
tests/integration/errors_test.py:13: in test_api_error_parses_json
    assert 'You cannot remove a running container' in explanation
E   AssertionError: assert 'You cannot remove a running container' in 'cannot remove container 4b90ce2e907dd0f99d0f561619b803e7a2a31809ced366c537874dd13f8a47ec: container is running: stop the container before removing or force remove'

This updates the tests to match on a string that will be present in both the old and new error-messages, but added a "lower()", so that matching will be done case-insensitive (Go errors generally should be lowercase).

I was in the process of cleaning up some error-messages, and it looks like
the docker-py tests were depending on strings that will be removed;

    =================================== FAILURES ===================================
    _____________ CreateContainerTest.test_create_with_restart_policy ______________
    tests/integration/api_container_test.py:126: in test_create_with_restart_policy
        assert 'You cannot remove ' in err
    E   AssertionError: assert 'You cannot remove ' in 'cannot remove container d11580f6078108691096ec8a23404a6bda9ad1d1b2bafe88b17d127a67728833: container is restarting: stop the container before removing or force remove'
    ____________________ ErrorsTest.test_api_error_parses_json _____________________
    tests/integration/errors_test.py:13: in test_api_error_parses_json
        assert 'You cannot remove a running container' in explanation
    E   AssertionError: assert 'You cannot remove a running container' in 'cannot remove container 4b90ce2e907dd0f99d0f561619b803e7a2a31809ced366c537874dd13f8a47ec: container is running: stop the container before removing or force remove'

This updates the tests to match on a string that will be present in both the
old and new error-messages, but added a "lower()", so that matching will be
done case-insensitive (Go errors generally should be lowercase).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@milas milas merged commit 79c4c38 into docker:main Aug 14, 2023
10 checks passed
@thaJeztah thaJeztah deleted the tests_relax branch August 14, 2023 14:34
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