Merge pull request #3846 from tjamet/test-race-condition
Fix race condition in metric process collector test
This commit is contained in:
commit
c6f4ffd686
1 changed files with 3 additions and 0 deletions
|
@ -55,11 +55,13 @@ func TestProcessCollector(t *testing.T) {
|
||||||
} else {
|
} else {
|
||||||
t.Logf("Status: %v", status.ExitStatus())
|
t.Logf("Status: %v", status.ExitStatus())
|
||||||
}
|
}
|
||||||
|
done <- struct{}{}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
cm, err := NewNGINXProcess("pod", "default", "nginx")
|
cm, err := NewNGINXProcess("pod", "default", "nginx")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error creating nginx status collector: %v", err)
|
t.Errorf("unexpected error creating nginx status collector: %v", err)
|
||||||
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
go cm.Start()
|
go cm.Start()
|
||||||
|
@ -68,6 +70,7 @@ func TestProcessCollector(t *testing.T) {
|
||||||
cm.Stop()
|
cm.Stop()
|
||||||
|
|
||||||
cmd.Process.Kill()
|
cmd.Process.Kill()
|
||||||
|
<-done
|
||||||
close(done)
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue