-
Notifications
You must be signed in to change notification settings - Fork 46
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
Update notify-rs to Version 5 #453
Conversation
DebouncedEvent::Remove(_) => None, | ||
// Ignore attribute changes | ||
DebouncedEvent::Chmod(_) => None, | ||
if let Some(mapped_event) = match received.kind { |
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.
The receive()
method where the raw filesystem events are mapped. The structure of these events has changed so as results the mapping are different.
@@ -1696,6 +1695,42 @@ mod tests { | |||
Ok(()) | |||
} | |||
|
|||
#[tokio::test] | |||
#[cfg(windows)] | |||
async fn filesystem_rotate_create_copy_win() -> io::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.
Windows specific filesystem
tests have an _win
suffix. The intermediate test macros cause the deletes to fail so to work around this I've added specific file asserts within the thread where the files are created and deleted. They don't mimic the original tests exactly but provide some test coverage.
use time::OffsetDateTime; | ||
|
||
type PathId = std::path::PathBuf; | ||
|
||
#[cfg(target_os = "linux")] | ||
type OsWatcher = notify::INotifyWatcher; | ||
#[cfg(not(any(target_os = "linux")))] | ||
type OsWatcher = notify::PollWatcher; | ||
type OsWatcher = notify::RecommendedWatcher; |
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.
Using the RecommendedWatcher
here because initially less tests were failing with it. It also fixes the another Windows issue we've been tracking.l
@@ -247,10 +302,11 @@ mod tests { | |||
} | |||
|
|||
#[tokio::test] | |||
#[cfg(unix)] |
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.
This test only works on unix.
Jenkinsfile
Outdated
@@ -65,20 +65,20 @@ pipeline { | |||
} | |||
stage('Lint and Unit Test') { | |||
parallel { | |||
stage('Lint'){ |
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.
Lint stage temporarily commented out.
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, except disabling the linting.
Updates
notify-rs
to version 5.0.0. The event objects have been completely refactored and the debouncer has been removed in v5. As a result the mapped events in the receiver method had to be refactored.Testing: