-
Notifications
You must be signed in to change notification settings - Fork 275
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: Add ngclient root key rotation tests #1635
Conversation
e63daf2
to
631a640
Compare
Pull Request Test Coverage Report for Build 1384520773Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
tests/repository_simulator.py
Outdated
def add_signer(self, role:str, signer: SSlibSigner): | ||
if role not in self.signers: | ||
self.signers[role] = {} | ||
self.signers[role][signer.key_dict["keyid"]] = signer |
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.
oops, indent issue here
I should also fix some linter issues if we're going to enable the linter on tests... |
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.
It looks ok to me, I didn't hit the approve button so that you fix the indent and the commits creator :)
tests/test_updater_key_rotations.py
Outdated
# Copyright 2021, New York University and the TUF contributors | ||
# SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
"""Test ngclient Updater using the repository simulator |
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.
nit: the docstring needs to be updated.
tests/test_updater_key_rotations.py
Outdated
RootVersion([0,1,2,3,4], 3, [0,2,4]), | ||
RootVersion([0,1,3,4,5], 3, [0,4,1]), | ||
], | ||
"3-of-5, one key rotate fails: not signed with 3 keys from last root" : [ |
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.
nit: "from new root"
ah and yeah, I think we need to add smaller tests for other keys as well, not necessarily with this PR. |
631a640
to
d4f839a
Compare
Store signers with their keyids so they are easier to remove. The signers structure now looks like: { "role1": { "keyidA": SSlibSigner, "keyidB": SSlibSigner, } } Add convenience method for adding a signer. Signed-off-by: Jussi Kukkonen <[email protected]>
Signed-off-by: Jussi Kukkonen <[email protected]>
Add one test with 1 subtests for various root key rotation situations. The test data definition format is a bit tricky but I tried to document that in the test function docstring. Signed-off-by: Jussi Kukkonen <[email protected]>
d4f839a
to
e817473
Compare
The last push is just rebase on recent RepositorySimulator changes.
Not promising it's 100% there (hard to test without merging with martins PR), but most of the issues should be handled: I'll merge this with the current approval. @MVrachev if there's something exceptionally annoying when you try rebasing, let me know |
Add 15 key rotation cases to ngclient tests.
Maybe fixes #1607? This only tests root keys but I think this is the tricky part: maybe there should be a small test for other keys as well...