Commit cdd8d0e2f4
Verified · cmc
e2e/buildfollow_test.go +9
| @@ -102,6 +102,15 @@ func TestBuildLogFollow(t *testing.T) { | ||
| 102 | 102 | if err := cmd.Start(); err != nil { |
| 103 | 103 | t.Fatal(err) |
| 104 | 104 | } |
| 105 | // If the test fails before the final cmd.Wait below, kill the follow | |
| 106 | // instead of leaving it running. Once that Wait has run, | |
| 107 | // cmd.ProcessState is set and this is a no-op. | |
| 108 | defer func() { | |
| 109 | if cmd.ProcessState == nil { | |
| 110 | cmd.Process.Kill() | |
| 111 | cmd.Wait() | |
| 112 | } | |
| 113 | }() | |
| 105 | 114 | follow := newStreamReader(stdout) |
| 106 | 115 | |
| 107 | 116 | page, err := http.Get(fmt.Sprintf("http://127.0.0.1:%d/alice/app/builds/1", inst.httpPort)) |