Skip to content

Commit

Permalink
grpctest: defer Teardown to guarantee it is run even after t.Fatal (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored Jan 14, 2019
1 parent 9e7c146 commit f647b6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/grpctest/grpctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ func RunSubTests(t *testing.T, x interface{}) {
tfunc := getTestFunc(t, xv, methodName)
t.Run(strings.TrimPrefix(methodName, "Test"), func(t *testing.T) {
setup(t)
// defer teardown to guarantee it is run even if tfunc uses t.Fatal()
defer teardown(t)
tfunc(t)
teardown(t)
})
}
}

0 comments on commit f647b6f

Please sign in to comment.