mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Fix #33784, IN_CREATE event does not guarantee file content written
This commit is contained in:
parent
4f27c740fa
commit
dfa4e66b15
@ -261,32 +261,13 @@ func watchFileAdded(watchDir bool, t *testing.T) {
|
|||||||
testCase.writeToFile(dirName, fileName, t)
|
testCase.writeToFile(dirName, fileName, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
if watchDir {
|
|
||||||
defer func() {
|
|
||||||
// Remove the file
|
|
||||||
deleteFile(dirName, fileName, ch, t)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
go addFile()
|
go addFile()
|
||||||
|
|
||||||
if watchDir {
|
// For !watchDir: expect an update by SourceFile.resetStoreFromPath().
|
||||||
// expect an update by CREATE inotify event
|
// For watchDir: expect at least one update from CREATE & MODIFY inotify event.
|
||||||
expectUpdate(t, ch, testCase)
|
// Shouldn't expect two updates from CREATE & MODIFY because CREATE doesn't guarantee file written.
|
||||||
// expect an update by MODIFY inotify event
|
// In that case no update will be sent from CREATE event.
|
||||||
expectUpdate(t, ch, testCase)
|
expectUpdate(t, ch, testCase)
|
||||||
|
|
||||||
from := fileName
|
|
||||||
fileName = fileName + "_ch"
|
|
||||||
go changeFileName(dirName, from, fileName, t)
|
|
||||||
// expect an update by MOVED_FROM inotify event cause changing file name
|
|
||||||
expectEmptyUpdate(t, ch)
|
|
||||||
// expect an update by MOVED_TO inotify event cause changing file name
|
|
||||||
expectUpdate(t, ch, testCase)
|
|
||||||
} else {
|
|
||||||
// expect an update by SourceFile.resetStoreFromPath()
|
|
||||||
expectUpdate(t, ch, testCase)
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user