Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 516c3fb

Browse files
committed
better logging
so you can see timing info everywhere needed
1 parent 518ad1f commit 516c3fb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

stacktest/tests/end2end_carbon/end2end_carbon_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package end2end_carbon
22

33
import (
4-
"fmt"
54
"log"
65
"os"
76
"os/exec"
@@ -25,7 +24,7 @@ var fm *fakemetrics.FakeMetrics
2524
const metricsPerSecond = 1000
2625

2726
func TestMain(m *testing.M) {
28-
fmt.Println("launching docker-dev stack...")
27+
log.Println("launching docker-dev stack...")
2928
cmd := exec.Command(docker.Path("docker/launch.sh"), "docker-dev")
3029
var err error
3130

@@ -42,19 +41,20 @@ func TestMain(m *testing.M) {
4241
retcode := m.Run()
4342
fm.Close()
4443

45-
fmt.Println("stopping docker-compose stack...")
44+
log.Println("stopping docker-compose stack...")
4645
cmd.Process.Signal(syscall.SIGINT)
4746
// note: even when we don't care about the output, it's best to consume it before calling cmd.Wait()
4847
// even though the cmd.Wait docs say it will wait for stdout/stderr copying to complete
4948
// however the docs for cmd.StdoutPipe say "it is incorrect to call Wait before all reads from the pipe have completed"
5049
tracker.Wait()
51-
if err := cmd.Wait(); err != nil {
52-
// 130 means ctrl-C (interrupt) which is what we want
53-
if err.Error() == "exit status 130" {
54-
os.Exit(retcode)
55-
}
50+
err = cmd.Wait()
51+
52+
// 130 means ctrl-C (interrupt) which is what we want
53+
if err != nil && err.Error() != "exit status 130" {
5654
log.Printf("ERROR: could not cleanly shutdown running docker-compose command: %s", err)
5755
retcode = 1
56+
} else {
57+
log.Println("docker-compose stack is shut down")
5858
}
5959

6060
os.Exit(retcode)
@@ -68,8 +68,8 @@ func TestStartup(t *testing.T) {
6868
}
6969
select {
7070
case <-tracker.Match(matchers):
71-
fmt.Println("stack now running.")
72-
fmt.Println("Go to http://localhost:3000 (and login as admin:admin) to see what's going on")
71+
log.Println("stack now running.")
72+
log.Println("Go to http://localhost:3000 (and login as admin:admin) to see what's going on")
7373
case <-time.After(time.Second * 70):
7474
grafana.PostAnnotation("TestStartup:FAIL")
7575
t.Fatal("timed out while waiting for all metrictank instances to come up")

0 commit comments

Comments
 (0)