grpctest: defer Teardown to guarantee it is run even after t.Fatal (#2562)

This commit is contained in:
Doug Fawley 2019-01-14 15:22:43 -08:00 committed by GitHub
parent 9e7c146356
commit f647b6facb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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)
})
}
}