-
Notifications
You must be signed in to change notification settings - Fork 5
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
test artifact caching #260
Conversation
Artifact caching is not part of the spec but it is a good idea * Client CLI document did not require caching before: Add it in the doc * Add test that verifies that two download commands do not result in two downloads * python test client did not support this so support was added Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
d9d5fbb
to
1df60e1
Compare
The potential argument against adding this test is that caching might not be a feature of the tuf library itself (since it's somewhat trivial for most applications to do) but
|
@@ -238,3 +238,28 @@ def test_download_with_unknown_hash_algorithm( | |||
# and only then realize hash cannot be verified | |||
assert client.download_target(init_data, target_path) == 1 | |||
assert client.get_downloaded_target_bytes() == [] | |||
|
|||
|
|||
def test_artifact_cache(client: ClientRunner, server: SimulatorServer) -> None: |
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.
Should we include the test where the artifact should be downloaded again because the contents changed?
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.
test_multiple_changes_to_target
should handle that along with other cases...
I can see some advantage from having a simple test that would only test what you suggest (instead of a long test that tests multiple things), but it does not seem strictly necessary 🤷
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.
Oh no I'm just not aware of what was in there and it was too much work from my phone to go looking. Lgtm.
Artifact caching is not part of the spec but it is a good idea
we already have tests for making sure that if artifact content changes the new content is downloaded, so I did not test that here