Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Metadata tests followup #54

Merged
merged 7 commits into from
Aug 18, 2023
Merged

Conversation

ivanayov
Copy link
Contributor

This change completes the metadata api test coverage with reference to the python-tuf implementation, excluding few use-cases that are not applicable

Provides two small metadata fixes and an improved test repository data.

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +18.66% 🎉

Comparison is base (050c711) 52.06% compared to head (b30c860) 70.72%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #54       +/-   ##
===========================================
+ Coverage   52.06%   70.72%   +18.66%     
===========================================
  Files           7        7               
  Lines        1281     1288        +7     
===========================================
+ Hits          667      911      +244     
+ Misses        540      305      -235     
+ Partials       74       72        -2     
Flag Coverage Δ
Go-1.20 70.72% <100.00%> (+18.66%) ⬆️
Go-1.21 70.72% <100.00%> (+18.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
metadata/metadata.go 77.76% <100.00%> (+31.34%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@rdimitrov rdimitrov left a comment

Choose a reason for hiding this comment

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

Thanks for the follow-up. Can you also check and address why the CI fails?

metadata/metadata.go Outdated Show resolved Hide resolved
metadata/metadata.go Show resolved Hide resolved
metadata/metadata_test.go Show resolved Hide resolved
@ivanayov
Copy link
Contributor Author

Thanks @rdimitrov. The CI fails running the examples with Download failed: target demo/succinctly-delegated-5.txt not found: expired metadata error: new demo-bin-1e is expired, but it's not related to the changes.

There is a go-linter check that I'll fix and push.

@ivanayov
Copy link
Contributor Author

Go linter is fixed.

Copy link
Owner

@rdimitrov rdimitrov left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback 💯 We should be okay to merge it once we resolve the last comment 👍

metadata/metadata.go Outdated Show resolved Hide resolved
metadata/metadata.go Show resolved Hide resolved
metadata/metadata_test.go Show resolved Hide resolved
Previously Targets' `AddKey(key, role)` was returning error that
role doesn't exist in the case when role exists and already has
that key. This change fixes that and alligns the function with the
python-tuf reference implementation, where the key is added to
delegations, even if it's not added to Roles and SuccinctRoles

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
Previously the target file path hash was not base64 URL encoded
which ended up to not being able to properly compare if role's
PathHashPrefixes contains a prefix of that hash. This change
fixes the encoding

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
This allows testing if the suffix len is properly calculated in
the metadata

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
This change changes the targets files used for targets metadata
to be simplified and neutral for the purpose of more clear and less
mistake-prone test cases. It also adds new keys for additional
metadata api testing

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
This change completes the metadata api test coverage with
reference to the python-tuf implementations, excluding few use-
cases that are not applicable

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
This fixes few error checks that were not handled in the metadata
api tests

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
This change provides tiny updates of two metalada helper functions
to giarantee more stable testing over time

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
@ivanayov
Copy link
Contributor Author

Thanks @rdimitrov, just pushed the updates and rebased with the fixed CI.

@rdimitrov rdimitrov merged commit 1c0a44b into rdimitrov:main Aug 18, 2023
17 of 21 checks passed
kipz pushed a commit to kipz/go-tuf-metadata that referenced this pull request Jan 29, 2024
* Fix AddKey for targets

Previously Targets' `AddKey(key, role)` was returning error that
role doesn't exist in the case when role exists and already has
that key. This change fixes that and alligns the function with the
python-tuf reference implementation, where the key is added to
delegations, even if it's not added to Roles and SuccinctRoles

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

* Fix delegated path prefix check

Previously the target file path hash was not base64 URL encoded
which ended up to not being able to properly compare if role's
PathHashPrefixes contains a prefix of that hash. This change
fixes the encoding

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

* Add SuccinctRoles.GetSuffixLen() for the purpose of testing

This allows testing if the suffix len is properly calculated in
the metadata

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

* Add test repository data improvements

This change changes the targets files used for targets metadata
to be simplified and neutral for the purpose of more clear and less
mistake-prone test cases. It also adds new keys for additional
metadata api testing

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

* Add more metadata api tests

This change completes the metadata api test coverage with
reference to the python-tuf implementations, excluding few use-
cases that are not applicable

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

* Fix go linter checks for metadata api tests

This fixes few error checks that were not handled in the metadata
api tests

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

* Improve metadata hepler test functions usage

This change provides tiny updates of two metalada helper functions
to giarantee more stable testing over time

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>

---------

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants