test: add API test for signature inheritance on OCI index children - #23707
test: add API test for signature inheritance on OCI index children#23707Aloui-Ikram wants to merge 3 commits into
Conversation
Covers the inherited_accessories field added in goharbor#23540. The test signs an index with cosign and with notation, then checks that a child of that index reports both signatures as inherited with the index digest as their subject, while owning no accessory of its own and returning nothing extra on a request that does not ask for them. notation cert generate-test refuses to overwrite an existing key, so generate_cert takes a common name and this test uses one of its own instead of colliding with test_notation_sign_artifact.py in the same suite. Signed-off-by: Ikram Aloui <ikram@container-registry.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23707 +/- ##
==========================================
- Coverage 66.59% 66.59% -0.01%
==========================================
Files 1080 1080
Lines 118640 118640
Branches 2992 2992
==========================================
- Hits 79012 79004 -8
- Misses 35254 35260 +6
- Partials 4374 4376 +2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds end-to-end API coverage for OCI index signature inheritance.
Changes:
- Tests cosign and notation signature inheritance.
- Adds inherited-accessory query support to test helpers.
- Allows notation tests to use distinct certificate names.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/robot-cases/Group0-BAT/API_DB.robot |
Registers the API test. |
tests/apitests/python/test_signature_inheritance.py |
Exercises index signature inheritance. |
tests/apitests/python/library/notation.py |
Parameterizes certificate names. |
tests/apitests/python/library/artifact.py |
Supports the inherited-accessory query parameter. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| child = self.artifact.get_reference_info(TestSignatureInheritance.project_name, self.index_name, child_digest, | ||
| **TestSignatureInheritance.user_client) | ||
| self.assertIsNone(child.inherited_accessories) |
|
@Aloui-Ikram can you fix the CI failure? I tried to rerun, but cannot have it success. |
@wy65701436 i dont think it comes from this PR , the new case passes in that run : |
|
One more thing, it looks like a real adapter bug and not just a CI setup issue. The listing endpoint already accepts a name and Happy to send that as a separate PR. Passing |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
tests/apitests/python/test_signature_inheritance.py:129
- This does not verify that the default JSON response contains “nothing extra.” The generated Swagger model defines
inherited_accessoriesand deserializes both an omitted property and an explicit JSONnulltoNone, so this assertion would pass if the API contract regressed by emitting the new key. Assert against the raw response JSON thatinherited_accessoriesis absent.
child = self.artifact.get_reference_info(TestSignatureInheritance.project_name, self.index_name, child_digest,
**TestSignatureInheritance.user_client)
self.assertIsNone(child.inherited_accessories)
tests/apitests/python/test_signature_inheritance.py:98
- This fixed common name makes the new test fail when it is rerun on the same worker: as noted in
notation.generate_cert,notation cert generate-testwill not overwrite the key left by the first run. Use a per-run value (the generated project name is already unique) so retries and repeated local runs remain reliable.
notation.generate_cert(common_name = "inherited-signature.io")

Covers the inherited_accessories field added in #23540. The test signs an index with cosign and with notation, then checks that a child of that index reports both signatures as inherited with the index digest as their subject, while owning no accessory of its own and returning nothing extra on a request that does not ask for them.
notation cert generate-test refuses to overwrite an existing key, so generate_cert takes a common name and this test uses one of its own instead of colliding with test_notation_sign_artifact.py in the same suite.
Thank you for contributing to Harbor!
Comprehensive Summary of your change
Issue being fixed
Please indicate you've done the following: