fileutil: reimplement file watcher (#5498)

* remove context, add close

* update tests

* cleanup

* fileutil: reimplement file watcher

* remove test, simplify tree set code, fix data race
This commit is contained in:
Caleb Doxsey 2025-02-26 09:21:06 -07:00 committed by GitHub
parent 1b2618170d
commit 1f30dead31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 332 additions and 103 deletions

View file

@ -190,23 +190,6 @@ runtime_flags:
}
require.Empty(t, ch, "expected exactly one OnConfigChange event")
// the file watcher checks modification time, not contents
err = os.Chtimes(configFilePath, time.Now(), time.Now())
require.NoError(t, err)
select {
case <-ch:
if !enabled {
t.Error("expected OnConfigChange not to be fired after triggering a change to the underlying source")
}
case <-time.After(time.Second):
if enabled {
t.Error("expected OnConfigChange to be fired after triggering a change to the underlying source")
}
}
require.Empty(t, ch, "expected exactly one OnConfigChange event")
}
}