diff --git a/Makefile b/Makefile index b74476bd..deea0548 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ style: test: collector/fixtures/sys/.unpacked @echo ">> running tests" - @$(GO) test -short $(pkgs) + @$(GO) test -short -race $(pkgs) collector/fixtures/sys/.unpacked: collector/fixtures/sys.ttar ./ttar -C collector/fixtures -x -f collector/fixtures/sys.ttar diff --git a/node_exporter_test.go b/node_exporter_test.go index 3b579492..b5c77af6 100644 --- a/node_exporter_test.go +++ b/node_exporter_test.go @@ -107,9 +107,13 @@ func queryExporter(address string) error { } func runCommandAndTests(cmd *exec.Cmd, fn func(pid int) error) error { + if err := cmd.Start(); err != nil { + return fmt.Errorf("failed to start command: %s", err) + } + errc := make(chan error) go func() { - if err := cmd.Run(); err != nil { + if err := cmd.Wait(); err != nil { errc <- fmt.Errorf("execution of command failed: %s", err) } else { errc <- nil