test(config/file): fix the unit test TestFile being blocked on Windows

pull/2612/head
mstmdev 2 years ago
parent f03f5f8988
commit f254a96d00
  1. 9
      config/file/file_test.go

@ -114,11 +114,14 @@ func testWatchFile(t *testing.T, path string) {
if err != nil {
t.Error(err)
}
defer f.Close()
_, err = f.WriteString(_testJSONUpdate)
if err != nil {
t.Error(err)
}
if err = f.Close(); err != nil {
t.Fatalf("close file error(%v)", err)
}
kvs, err := watch.Next()
if err != nil {
t.Errorf("watch.Next() error(%v)", err)
@ -163,11 +166,13 @@ func testWatchDir(t *testing.T, path, file string) {
if err != nil {
t.Error(err)
}
defer f.Close()
_, err = f.WriteString(_testJSONUpdate)
if err != nil {
t.Error(err)
}
if err = f.Close(); err != nil {
t.Fatalf("close file error(%v)", err)
}
kvs, err := watch.Next()
if err != nil {

Loading…
Cancel
Save