mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
Fix file SD test
This commit is contained in:
parent
a92134a947
commit
efb39cfd4e
|
@ -81,17 +81,24 @@ func testFileSD(t *testing.T, ext string) {
|
||||||
// Below we will change the file to a bad syntax. Previously extracted target
|
// Below we will change the file to a bad syntax. Previously extracted target
|
||||||
// groups must not be deleted via sending an empty target group.
|
// groups must not be deleted via sending an empty target group.
|
||||||
if len(tg.Targets) == 0 {
|
if len(tg.Targets) == 0 {
|
||||||
t.Fatalf("Unexpected empty target group received: %s", tg)
|
t.Errorf("Unexpected empty target group received: %s", tg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
newf, err = os.Create("fixtures/_test" + ext)
|
newf, err = os.Create("fixtures/_test.new")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer os.Remove(newf.Name())
|
||||||
|
|
||||||
if _, err := newf.Write([]byte("]gibberish\n][")); err != nil {
|
if _, err := newf.Write([]byte("]gibberish\n][")); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
newf.Close()
|
newf.Close()
|
||||||
|
|
||||||
|
os.Rename(newf.Name(), "fixtures/_test"+ext)
|
||||||
|
|
||||||
|
// Give notifcations some time to arrive.
|
||||||
|
time.Sleep(50 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue