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 extraction using an expected hash #40

Closed
baszalmstra opened this issue Feb 5, 2023 · 2 comments
Closed

Test extraction using an expected hash #40

baszalmstra opened this issue Feb 5, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@baszalmstra
Copy link
Collaborator

Currently, the tests for package extraction just check if the process doesn't error out. This doesn't really test if a package is properly extracted.

The tests for validating packages do use the same code to extract a package and validate its content but it would be nice if we could compute a sha256 hash of an extracted package and validate that that is indeed what we would expect.

We can use the rstest crate to create test cases with the package to extract and an expected hash as an input. e.g.:

#[rstest]
#[case("some_package.conda", "somecomplexshahashnumber")]
fn validate_extracted_packages(#[case] path: &str, #[case] hash: &str) {
 // ...
}

When developing this feature some care is required to ensure that symlinks are properly hashed. I think it would be better to hash the link itself instead of the content it points to. This is because ../a and ./../a refer to the same file but are different symlinks.

@baszalmstra baszalmstra added the good first issue Good for newcomers label Feb 5, 2023
@wolfv
Copy link
Contributor

wolfv commented Jul 23, 2023

I think we're now checking all the files in the extracted packages folder when linking, so we can be at least reasonably sure that this is indeed working fine :)

@baszalmstra
Copy link
Collaborator Author

This has been added a while back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants