-
Notifications
You must be signed in to change notification settings - Fork 278
RepositorySimulator: add trackers/counters for downloaded files #1682
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
Milestone
Comments
3 tasks
I will work on it. |
basically my idea was that
|
kairoaraujo
pushed a commit
to kairoaraujo/python-tuf
that referenced
this issue
Dec 1, 2021
This change is to implement a feature to track the fetch calls to the metadata and targets. This feature was mentioned in PR theupdateframework#1666 that generated issue theupdateframework#1682. It is the ``RepositorySimulator.fetch_tracker``. It also changes the ``test_updater_consistent_snapshot`` to use the fetch_tracker instead of mocking it. It implements a ``dataclass`` that stores the calls to fetch metadata (``_fetch_metadata``) and targets (``_fetch_targets``). This dataclass has a method to clean (``clear``) the current metadata and targets tracker. The fetch calls for metadata are stored as a list of tuples that contains metadata role name and version, and fetch calls for targets are stored as a list of target paths. Signed-off-by: Kairo de Araujo <[email protected]>
kairoaraujo
pushed a commit
to kairoaraujo/python-tuf
that referenced
this issue
Dec 2, 2021
This commit implements a feature in Repository Simulator to track the fetch calls to the metadata and targets. This feature was mentioned in PR theupdateframework#1666 that generated issue theupdateframework#1682. This commit adds ``RepositorySimulator.fetch_tracker``. It also changes the ``tests/test_updater_consistent_snapshot.py`` to use the ``fetch_tracker`` instead of using mock. It implements a ``dataclass`` that stores the calls to fetch metadata (``_fetch_metadata``) in ``fetch_tracker.metadata`` and targets (``_fetch_targets``) in ``fetch_tracker.targets``. The fetch calls for metadata, and targets are stored as lists. Signed-off-by: Kairo de Araujo <[email protected]>
3 tasks
kairoaraujo
pushed a commit
to kairoaraujo/python-tuf
that referenced
this issue
Dec 3, 2021
This commit implements a feature in Repository Simulator to track the fetch calls to the metadata and targets. This feature was mentioned in PR theupdateframework#1666 that generated issue theupdateframework#1682. This commit adds RepositorySimulator.fetch_tracker. It also changes the tests/test_updater_consistent_snapshot.py to use the fetch_tracker instead of using mock. It implements a dataclass that stores the calls to fetch metadata (_fetch_metadata) in fetch_tracker.metadata and targets (_fetch_targets) in fetch_tracker.targets. The fetch calls for metadata, and targets are stored as lists. Signed-off-by: Kairo de Araujo <[email protected]>
3 tasks
kairoaraujo
pushed a commit
to kairoaraujo/python-tuf
that referenced
this issue
Dec 3, 2021
This commit implements a feature in Repository Simulator to track the fetch calls to the metadata and targets. This feature was mentioned in PR theupdateframework#1666 that generated issue theupdateframework#1682. This commit adds RepositorySimulator.fetch_tracker. It also changes the tests/test_updater_consistent_snapshot.py to use the fetch_tracker instead of using mock. It implements a dataclass that stores the calls to fetch metadata (_fetch_metadata) in fetch_tracker.metadata and targets (_fetch_targets) in fetch_tracker.targets. The fetch calls for metadata, and targets are stored as lists. Signed-off-by: Kairo de Araujo <[email protected]>
kairoaraujo
pushed a commit
to kairoaraujo/python-tuf
that referenced
this issue
Dec 7, 2021
This commit implements a feature in Repository Simulator to track the fetch calls to the metadata and targets. This feature was mentioned in PR theupdateframework#1666 that generated issue theupdateframework#1682. This commit adds RepositorySimulator.fetch_tracker. It also changes the tests/test_updater_consistent_snapshot.py to use the fetch_tracker instead of using mock. It implements a dataclass that stores the calls to fetch metadata (_fetch_metadata) in fetch_tracker.metadata and targets (_fetch_targets) in fetch_tracker.targets. The fetch calls for metadata, and targets are stored as lists. Signed-off-by: Kairo de Araujo <[email protected]>
kairoaraujo
pushed a commit
to kairoaraujo/python-tuf
that referenced
this issue
Dec 8, 2021
This commit implements a feature in Repository Simulator to track the fetch calls to the metadata and targets. This feature was mentioned in PR theupdateframework#1666 that generated issue theupdateframework#1682. This commit adds RepositorySimulator.fetch_tracker. It also changes the tests/test_updater_consistent_snapshot.py to use the fetch_tracker instead of using mock. It implements a dataclass that stores the calls to fetch metadata (_fetch_metadata) in fetch_tracker.metadata and targets (_fetch_targets) in fetch_tracker.targets. The fetch calls for metadata, and targets are stored as lists. Signed-off-by: Kairo de Araujo <[email protected]>
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of issue or feature request:
There is a need in some test cases to check whether Updater requested the correct files from the repository.
For a concrete use case see #1666.
One option used in #1666 is to use
unittest.mock
and "wrap"RepositorySimulator._fetch_*
methods which does the job but does make the tests less readable.Therefore as an alternative, proposed by @jku #1666 (review), checking that the expected files are downloaded from remote can be done by adding some download counters into
RepositorySimulator
which would be cleaner and more maintainableThe text was updated successfully, but these errors were encountered: