Skip to content
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

refactor a keys test #160

Merged
merged 4 commits into from
Aug 21, 2024
Merged

refactor a keys test #160

merged 4 commits into from
Aug 21, 2024

Conversation

AdamKorcz
Copy link
Contributor

@AdamKorcz AdamKorcz commented Aug 20, 2024

  1. Removes some setup steps from initial_setup_for_key_threshold.
  2. Adds comment to describe initial_setup_for_key_threshold.
  3. Adds comments to better describe the intention of test_root_has_keys_but_not_snapshot.
  4. Adds another assertion to test_root_has_keys_but_not_snapshot to demonstrate the intention of the test.

Signed-off-by: Adam Korczynski <[email protected]>
tuf_conformance/test_keys.py Outdated Show resolved Hide resolved
tuf_conformance/test_keys.py Outdated Show resolved Hide resolved
Signed-off-by: Adam Korczynski <[email protected]>
Comment on lines 39 to 40
roots keys and not check that the snapshot MD also has the
same keys. For example, the goal is to bring the repository
Copy link
Member

@jku jku Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client might calculate the threshold from only the roots keys and not check that the snapshot MD also has the same keys

Careful naming here (and in the test name) would help in understanding the test: Snapshot metadata contains no keys so the sentence does not make sense.

So now reader is left wondering if the meaning is that snapshot role (in root metadata) should have the same keys as root role or that snapshot metadata should have signatures from snapshot keys defined in root metadata

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of test name, wdyta test_root_meets_threshold_but_snapshot_does_not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's great ("root meets threshold" normally means something completely different from what the name refers to). But let's merge and move on.

Copy link
Member

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me. I still find some of the language hard to understand (keys and signatures are not the same thing) but it looks better now

repo.root.roles[Snapshot.type].threshold = 5
repo.bump_root_by_one() # v5
# Set the threshold to 4 and remove a signer from snapshot
# metadata so that root has 4 keys and snapshot has 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is still a really unclear comment:

root has 4 keys and snapshot has 3

snapshot role (in root metadata) contains 4 keys, snapshot metadata is signed by 3 keys

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed and reworded in 7b3260a. LMKWYT.

Signed-off-by: Adam Korczynski <[email protected]>
@jku jku merged commit 27a40ab into theupdateframework:main Aug 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants