chore: check error message in parts when testing the CreateContainerWithDirs method #576
+12
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
In the
TestDockerCreateContainerWithDirs
test method, there is a test table including an error message to be checked against the possible failure modes of that feature. This error message was created as a string to be compared with the expected error message from the Docker daemon while trying to copy the dirs to the container.In this PR, we are changing the type of that error message, from a string to an array of strings, so that we are able to check that all parts are contained in the error message from the daemon.
I acknowledge that testing an error message could lead to flakiness in the future, so we could simple remove the assertions.
Why is it important?
We have observed two different error messages in the Docker daemon for the same operation of copying a directory to a path that does not exist in the container.
Running the test on my
Mac M1
, where the Docker info is:I get the same error message from the daemon than before these changes:
But when running the test the Github actions, where we use
Ubuntu:latest
as build machines and the Docker info returns:we see that the error message for the very same operation is:
For that reason we are adding these changes, checking the error message in parts, not the entire string.
I've done a super quick search on Github looking for changes in the daemon responses on errors, but I could not find anything yet, but I probably need more time to find the original changes. In any case, I consider the different server version relevant for the changes.
Besides that, the fix for an upcoming release will be of interest.
Finally, the test failure is blocking other PRs in a non-deterministic manner: there are times where the GHA are passing and failing, probably because we are using
ubuntu:latest
. I wonder if Github infra is deterministic about the builder machines 🤔Related issues