Skip to content

Commit

Permalink
Ensures test timeouts don't kill the debugger (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancole authored Feb 13, 2020
1 parent d19b014 commit 89c11d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 The OpenZipkin Authors
* Copyright 2013-2020 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -26,6 +26,7 @@
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Rule;
import org.junit.rules.DisableOnDebug;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.rules.Timeout;
Expand All @@ -35,7 +36,7 @@
import static org.assertj.core.api.Assertions.assertThat;

public abstract class ITTracingFilter {
@Rule public Timeout globalTimeout = Timeout.seconds(5); // 5 seconds max per method
@Rule public TestRule globalTimeout = new DisableOnDebug(Timeout.seconds(5)); // max per method

/** See brave.http.ITHttp for rationale on using a concurrent blocking queue */
BlockingQueue<Span> spans = new LinkedBlockingQueue<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 The OpenZipkin Authors
* Copyright 2013-2020 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -27,6 +27,7 @@
import org.apache.dubbo.rpc.Filter;
import org.junit.After;
import org.junit.Rule;
import org.junit.rules.DisableOnDebug;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.rules.Timeout;
Expand All @@ -36,7 +37,7 @@
import static org.assertj.core.api.Assertions.assertThat;

public abstract class ITTracingFilter {
@Rule public Timeout globalTimeout = Timeout.seconds(5); // 5 seconds max per method
@Rule public TestRule globalTimeout = new DisableOnDebug(Timeout.seconds(5)); // max per method

/** See brave.http.ITHttp for rationale on using a concurrent blocking queue */
BlockingQueue<Span> spans = new LinkedBlockingQueue<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Rule;
import org.junit.rules.DisableOnDebug;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.rules.Timeout;
Expand Down Expand Up @@ -97,7 +98,7 @@ public abstract class ITHttp {
* This way, there's visibility on which method hung without asking the end users to edit build
* config.
*/
@Rule public Timeout globalTimeout = Timeout.seconds(5); // 5 seconds max per method
@Rule public TestRule globalTimeout = new DisableOnDebug(Timeout.seconds(5)); // max per method

public static final String EXTRA_KEY = "user-id";

Expand Down

0 comments on commit 89c11d7

Please sign in to comment.