mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
test(windows): fix watch file test
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
552e3bd0ca
commit
15c88da25c
1 changed files with 4 additions and 1 deletions
|
@ -2346,9 +2346,12 @@ func TestWatchFile(t *testing.T) {
|
|||
t.Logf("test config file: %s\n", configFile)
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
var wgDoneOnce sync.Once // OnConfigChange is called twice on Windows
|
||||
v.OnConfigChange(func(in fsnotify.Event) {
|
||||
t.Logf("config file changed")
|
||||
wg.Done()
|
||||
wgDoneOnce.Do(func() {
|
||||
wg.Done()
|
||||
})
|
||||
})
|
||||
v.WatchConfig()
|
||||
// when overwriting the file and waiting for the custom change notification handler to be triggered
|
||||
|
|
Loading…
Reference in a new issue