-
Notifications
You must be signed in to change notification settings - Fork 43
fix(aggregator): ancillary signing on evolving files #2425
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
fix(aggregator): ancillary signing on evolving files #2425
Conversation
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.
Pull Request Overview
This PR fixes ancillary file signing during snapshotting by copying evolving files to a temporary directory and updates test assertions to use an enhanced directory structure comparison macro.
- Introduces a new module (dir_eq) and macro (assert_dir_eq!) to compare directory structures in tests.
- Updates tests across multiple modules to use the new assert_dir_eq! macro and replaces legacy temporary directory utilities with temp_dir_create!.
- Adds functionality in the snapshotter to copy files to a temporary folder ensuring file consistency during ancillary signing.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
mithril-common/src/test_utils/mod.rs | Added dir_eq module and re-export. |
mithril-common/src/test_utils/dir_eq.rs | Introduced DirStructure and assert_dir_eq! macro implementation. |
mithril-client/* | Replaced filesystem assertions with assert_dir_eq! in various tests. |
mithril-aggregator/* | Updated file archiver/appender and snapshotter tests to use assert_dir_eq! and refactored ancillary snapshot handling. |
Comments suppressed due to low confidence (1)
mithril-aggregator/src/services/snapshotter/test_doubles.rs:320
- The function name 'test_fake_snasphotter' appears to contain a typo. Consider renaming it to 'test_fake_snapshotter' for clarity.
async fn test_fake_snasphotter() {
mithril-aggregator/src/services/snapshotter/compressed_archive_snapshotter.rs
Outdated
Show resolved
Hide resolved
49f8e90
to
45d73ba
Compare
45d73ba
to
6e70001
Compare
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.
LGTM
6e70001
to
c504bad
Compare
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.
LGTM
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.
LGTM 🚀
mithril-aggregator/src/services/snapshotter/compressed_archive_snapshotter.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/services/snapshotter/compressed_archive_snapshotter.rs
Outdated
Show resolved
Hide resolved
13b87bd
to
f872829
Compare
- use `temp_dir_create!` when applicable - remove uneeded intermediate variables
To avoid signing a manifest with files hashes that may be different from the one in the archived files since they may be evolving between the two operations.
Can be used against another directory or against a string that express the expected structure using `*` to tell the depth of each items.
* mithril-aggregator from `0.7.34` to `0.7.35` * mithril-client from `0.11.20` to `0.11.21` * mithril-common from `0.5.22` to `0.5.23`
f872829
to
733e8bb
Compare
Content
This PR make the aggregator copy the files that are included in an ancillary archive into a temporary folder so those files doesn't evolve while the snapshotting of ancillary is in progress, avoiding mismatch between sha of files in the ancillary manifest and the sha of files in the archive.
This PR also add a new test macro:
assert_dir_eq!
that allow comparison of two directories together or, more interestingly, against a string that codify the expected dir structure, i.e:Pre-submit checklist
Issue(s)
Relates to #2362