-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Assorted cleanups to reduce trust / notary imports #5878
Merged
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
This var used to be vendored from github.com/docker/docker/registry, but was removed there, and made a local var in a1cbaa8. It is (and should never be) modified, so let's change it into a const. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Add a basic helper to provide the equivalent of passphrase.ConstantRetriever with a fixed passphrase for testing. Signed-off-by: Sebastiaan van Stijn <[email protected]>
The test only validates that an error is produced because the notary server is offline, and does not sent a passphrase. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This test was only testing trust.GetSignableRoles to return an error if it's offline, which was duplicating the [TestGetSignableRolesError] test. [TestGetSignableRolesError]: https://github.com/docker/cli/blob/fe0a8d27912dc6fddc60cedcd35bbef27b776355/cli/trust/trust_test.go#L49-L55 Signed-off-by: Sebastiaan van Stijn <[email protected]>
This test was only testing trust.GetSignableRoles to return an error if it's offline, which was duplicating the [TestGetSignableRolesError] test. [TestGetSignableRolesError]: https://github.com/docker/cli/blob/fe0a8d27912dc6fddc60cedcd35bbef27b776355/cli/trust/trust_test.go#L49-L55 Signed-off-by: Sebastiaan van Stijn <[email protected]>
Add a basic helper to provide the equivalent of passphrase.ConstantRetriever with a fixed passphrase for testing. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This test was only testing trust.GetSignableRoles to return an error if it's offline, which was duplicating the [TestGetSignableRolesError] test in the cli/trust package. [TestGetSignableRolesError]: https://github.com/docker/cli/blob/fe0a8d27912dc6fddc60cedcd35bbef27b776355/cli/trust/trust_test.go#L49-L55 Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
These tests were not testing functionality that was implemented in the image package. Move them to the trust package, where they belong. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
This utility was shared between the "image" and "trust" packages, and a shallow wrapper around features in the cli/trust package. Move it there instead and rename it to `trust.AddToAllSignableRoles`. There are no known external consumers of this utility, so skipping a deprecation. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (10.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #5878 +/- ##
==========================================
- Coverage 59.32% 59.28% -0.04%
==========================================
Files 353 353
Lines 29748 29752 +4
==========================================
- Hits 17647 17639 -8
- Misses 11113 11127 +14
+ Partials 988 986 -2 |
Benehiko
approved these changes
Mar 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/dependencies
area/trust
kind/refactor
PR's that refactor, or clean-up code
status/2-code-review
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.
cli/trust: make NotaryServer a const
This var used to be vendored from github.com/docker/docker/registry, but was
removed there, and made a local var in a1cbaa8.
It is (and should never be) modified, so let's change it into a const.
internal/test/notary: add testPassRetriever helper
Add a basic helper to provide the equivalent of passphrase.ConstantRetriever
with a fixed passphrase for testing.
cli/command/trust: remove unused passphrase-retriever from test
The test only validates that an error is produced because the notary
server is offline, and does not sent a passphrase.
cli/command/trust: remove TestGetOrGenerateNotaryKeyAndInitRepo
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the TestGetSignableRolesError
test.
cli/command/trust: remove TestGetSignableRolesForTargetAndRemoveError
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the TestGetSignableRolesError
test.
cli/command/trust: add testPassRetriever helper
Add a basic helper to provide the equivalent of passphrase.ConstantRetriever
with a fixed passphrase for testing.
cli/command/image: remove TestAddTargetToAllSignableRolesError
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the TestGetSignableRolesError
test in the cli/trust package.
cli/command/image: use t.SetEnv in trust tests
cli/command/image: move trust unit-tests to trust package
These tests were not testing functionality that was implemented
in the image package. Move them to the trust package, where
they belong.
cli/command/trust: use gotest.tools in tests
cli/command/image: move AddTargetToAllSignableRoles to cli/trust
This utility was shared between the "image" and "trust" packages, and a
shallow wrapper around features in the cli/trust package. Move it there
instead and rename it to
trust.AddToAllSignableRoles
.There are no known external consumers of this utility, so skipping a
deprecation.
cli/command/image: rename vars that shadowed type
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)