mirror of https://github.com/grpc/grpc-go.git
grpctest: defer Teardown to guarantee it is run even after t.Fatal (#2562)
This commit is contained in:
parent
9e7c146356
commit
f647b6facb
|
|
@ -61,8 +61,9 @@ func RunSubTests(t *testing.T, x interface{}) {
|
||||||
tfunc := getTestFunc(t, xv, methodName)
|
tfunc := getTestFunc(t, xv, methodName)
|
||||||
t.Run(strings.TrimPrefix(methodName, "Test"), func(t *testing.T) {
|
t.Run(strings.TrimPrefix(methodName, "Test"), func(t *testing.T) {
|
||||||
setup(t)
|
setup(t)
|
||||||
|
// defer teardown to guarantee it is run even if tfunc uses t.Fatal()
|
||||||
|
defer teardown(t)
|
||||||
tfunc(t)
|
tfunc(t)
|
||||||
teardown(t)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue