-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
integration-cli: DockerPluginSuite: use gotest.tools compare utilities #44316
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thaJeztah
added
status/2-code-review
area/testing
area/plugins
kind/refactor
PR's that refactor, or clean-up code
labels
Oct 18, 2022
corhere
approved these changes
Oct 25, 2022
|
||
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name) | ||
assert.Assert(c, strings.Contains(strings.TrimSpace(env), mntSrc)) | ||
assert.Check(c, is.Contains(strings.TrimSpace(env), mntSrc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
assert.Check(c, is.Contains(strings.TrimSpace(env), mntSrc)) | |
assert.Check(c, is.Contains(env, mntSrc)) |
dockerCmd(c, "plugin", "set", name, "pmount1.source=bar") | ||
|
||
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name) | ||
assert.Assert(c, strings.Contains(strings.TrimSpace(env), "bar")) | ||
assert.Check(c, is.Contains(strings.TrimSpace(env), "bar")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
assert.Check(c, is.Contains(strings.TrimSpace(env), "bar")) | |
assert.Check(c, is.Contains(env, "bar")) |
Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah
force-pushed
the
plugin_improve_test_errors
branch
from
November 1, 2022 16:27
55b64f8
to
c207947
Compare
cpuguy83
approved these changes
Nov 2, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure.
Before this, tests would fail like:
With this patch, tests provide more useful output:
- A picture of a cute animal (not mandatory but encouraged)