Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
2b6011b to
2606352
Compare
2606352 to
807b2a9
Compare
| pub fn is_creation(&self) -> bool { | ||
| matches!(self.file, FileData::Creation(_)) | ||
| } | ||
|
|
||
| pub fn is_unlink(&self) -> bool { | ||
| matches!(self.file, FileData::Unlink(_)) | ||
| } | ||
|
|
There was a problem hiding this comment.
There has to be an idiomatic way of dispatching to a handling function depending on the type ; a match could be a way, but the is_creation() function wasn't going in that direction.
@Molter73 , what would you advise ?
| with open(original_file, 'w') as f: | ||
| f.write('This is a test') | ||
|
|
||
| # Create two hardlinks in the unmonitored directory | ||
| hardlink_file1 = os.path.join(ignored_dir, 'hardlink1.txt') | ||
| os.link(original_file, hardlink_file1) | ||
|
|
||
| hardlink_file2 = os.path.join(ignored_dir, 'hardlink2.txt') | ||
| os.link(original_file, hardlink_file2) | ||
|
|
||
| os.remove(hardlink_file1) | ||
| os.remove(hardlink_file2) |
There was a problem hiding this comment.
This seems to be flaky. The inode of the original file may not have landed in the probe's map before we start deleting.
I will split the test to wait for the CREATION event before going on with the unlinks.
Description
When a file is unlinked, the corresponding inode should be removed from the kernel inode map and also from the inode->path map in userland.
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
TODO(replace-me)
Use this space to explain how you tested your PR, or, if you didn't test it, why you did not do so. (Valid reasons include "CI is sufficient" or "No testable changes")
In addition to reviewing your code, reviewers must also review your testing instructions, and make sure they are sufficient.
For more details, ref the Confluence page about this section.