cmd/prometheus/main_unix_test.go: fix unix test styling

* Formatting of error message is missing a space after ':'.
* t.Fatalf should be used instead of  t.Errorf+return.

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
This commit is contained in:
Mateusz Gozdek 2021-11-10 10:43:50 +01:00 committed by Julien Pivotto
parent ed698c5480
commit 7bd7573891
1 changed files with 3 additions and 5 deletions

View File

@ -34,8 +34,7 @@ func TestStartupInterrupt(t *testing.T) {
prom := exec.Command(promPath, "-test.main", "--config.file="+promConfig, "--storage.tsdb.path="+t.TempDir()) prom := exec.Command(promPath, "-test.main", "--config.file="+promConfig, "--storage.tsdb.path="+t.TempDir())
err := prom.Start() err := prom.Start()
if err != nil { if err != nil {
t.Errorf("execution error: %v", err) t.Fatalf("execution error: %v", err)
return
} }
done := make(chan error, 1) done := make(chan error, 1)
@ -64,12 +63,11 @@ Loop:
} }
if !startedOk { if !startedOk {
t.Errorf("prometheus didn't start in the specified timeout") t.Fatal("prometheus didn't start in the specified timeout")
return
} }
if err := prom.Process.Kill(); err == nil { if err := prom.Process.Kill(); err == nil {
t.Errorf("prometheus didn't shutdown gracefully after sending the Interrupt signal") t.Errorf("prometheus didn't shutdown gracefully after sending the Interrupt signal")
} else if stoppedErr != nil && stoppedErr.Error() != "signal: interrupt" { // TODO - find a better way to detect when the process didn't exit as expected! } else if stoppedErr != nil && stoppedErr.Error() != "signal: interrupt" { // TODO - find a better way to detect when the process didn't exit as expected!
t.Errorf("prometheus exited with an unexpected error:%v", stoppedErr) t.Errorf("prometheus exited with an unexpected error: %v", stoppedErr)
} }
} }