Skip to content

Commit

Permalink
test(config): try another approach to make tests less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
Reasno committed Feb 24, 2021
1 parent 0a81de5 commit 05c3b20
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ func TestKoanfAdapter_Watch(t *gotesting.T) {
assert.Equal(t, "baz", ka.String("foo"))
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
end := make(chan struct{})
go func() {
ka.watcher.Watch(ctx, func() error {
assert.NoError(t, ka.Reload(), "reload should be successful")
end <- struct{}{}
return nil
})
}()
time.Sleep(time.Second)
ioutil.WriteFile(f.Name(), []byte("foo: bar"), 0644)
<-end
time.Sleep(time.Second)
assert.Equal(
t,
"bar",
Expand Down

0 comments on commit 05c3b20

Please sign in to comment.