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

test artifact caching #260

Merged
merged 1 commit into from
Feb 1, 2025
Merged

Conversation

jku
Copy link
Member

@jku jku commented Jan 30, 2025

Artifact caching is not part of the spec but it is a good idea

  • Client CLI document did not mention 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

we already have tests for making sure that if artifact content changes the new content is downloaded, so I did not test that here

@jku jku linked an issue Jan 30, 2025 that may be closed by this pull request
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>
@jku jku force-pushed the test-artifact-cache branch from d9d5fbb to 1df60e1 Compare January 30, 2025 18:06
@jku
Copy link
Member Author

jku commented Feb 1, 2025

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

  • I think xfailing the test is easy enough for users that don't see the point here
  • If it's easy for apps,it's also easy for the conformance client

@@ -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:
Copy link
Collaborator

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?

Copy link
Member Author

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 🤷

Copy link
Collaborator

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.

@jku jku merged commit 3cdbd5a into theupdateframework:main Feb 1, 2025
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.

test artifact caching
2 participants