Skip to content

Commit

Permalink
fix panic in Test_Main
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Jan 1, 2020
1 parent fcc2065 commit 6063994
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/app/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func Test_Main(t *testing.T) {
close(finished)
}()

// defer cleanup because require check below can fail
defer func() {
close(done)
<-finished
}()

waitForHTTPServerStart(port)
resp, err := http.Get(fmt.Sprintf("http://localhost:%d/api/v1/ping", port))
require.NoError(t, err)
Expand All @@ -49,9 +55,6 @@ func Test_Main(t *testing.T) {
body, err := ioutil.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, "pong", string(body))

close(done)
<-finished
}

func TestGetDump(t *testing.T) {
Expand Down

0 comments on commit 6063994

Please sign in to comment.