Skip to content

Conversation

@sandlbn
Copy link
Contributor

@sandlbn sandlbn commented May 19, 2025

  • Added unit tests for the key, signing, and verification functions
  • Created tests for hash calculation and verification in the hash module
  • Implemented tests for utility functions in the utils module
  • Fixed edge cases discovered during test creation

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

Copy link
Contributor

@marcelamelara marcelamelara 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 adding all these tests @sandlbn . They pass on my end, too! I have a couple of comments/suggestions.

Comment on lines 327 to 328
// Default case if nothing else matches
ManifestType::Model
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to Unknown.

}

#[test]
fn test_key_file_permissions() -> Result<()> {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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!

Copy link
Contributor

@marcelamelara marcelamelara 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 fixes, LGTM.

@marcelamelara marcelamelara merged commit 8ac485f into main May 23, 2025
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.

2 participants