-
Notifications
You must be signed in to change notification settings - Fork 1
Added unit tests for key loading, signing, and verification functions, fixed Manifest Type Detection Logic #4
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
Conversation
…, fixed manifest determ fn
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.
Thanks for adding all these tests @sandlbn . They pass on my end, too! I have a couple of comments/suggestions.
src/manifest/utils.rs
Outdated
| // Default case if nothing else matches | ||
| ManifestType::Model |
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 add a ManifestType::Unknown for cases where a type can't be easily determined? This way, we could directly check for this type when verification happens and error early.
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.
Updated to Unknown.
src/signing/mod.rs
Outdated
| } | ||
|
|
||
| #[test] | ||
| fn test_key_file_permissions() -> Result<()> { |
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.
Since it's a test key in temp, do we need this test? Instead, we might just want to delete the key explicitly at the end of each test. Plus key loading is already tested above.
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.
Good point about the redundancy! Though I think this test has a slightly different purpose - it's checking that we can load keys with restrictive permissions (0x600), which is pretty common for private keys. The temp cleanup happens automatically when TempDir is dropped, so we're good there. Maybe we could just rename it to something clearer like test_load_key_with_restrictive_permissions() to make it obvious why it exists?
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.
ah, thanks for clarifying that. Makes sense to me!
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.
thanks for the fixes, LGTM.
When writing tests I figure out that determine_manifest_type function wasn't correctly handling cases where conflicting information was present in assertions and ingredients. Tests were failing because the function was not following the expected priority when determining manifest types. Now checks for both assertions and ingredients for each type in priority order: Dataset > Software > Model