Skip to content

Commit bfb970c

Browse files
authored
testing: fix GrpcCleanupRule issue when retrying tests (grpc#8918)
Fix an issue in GrpcCleanupRule when tests are retried and the teardown() method is invoked multiple times, causing Stopwatch instance to throw an IllegalStateException. fixes grpc#8917.
1 parent df6db6f commit bfb970c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

testing/src/main/java/io/grpc/testing/GrpcCleanupRule.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public Statement apply(final Statement base, Description description) {
149149
return new Statement() {
150150
@Override
151151
public void evaluate() throws Throwable {
152+
firstException = null;
152153
try {
153154
base.evaluate();
154155
} catch (Throwable t) {
@@ -175,6 +176,7 @@ public void evaluate() throws Throwable {
175176
* Releases all the registered resources.
176177
*/
177178
private void teardown() {
179+
stopwatch.reset();
178180
stopwatch.start();
179181

180182
if (firstException == null) {

0 commit comments

Comments
 (0)