From 430f1cb56149639363ef42cad3a84af374997266 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Mon, 16 Aug 2021 20:11:09 +0300 Subject: [PATCH] Add junit test timeotut (#3850) --- .../test/InstrumentationSpecification.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationSpecification.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationSpecification.groovy index 0782c71bb6..5dfde8417e 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationSpecification.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationSpecification.groovy @@ -16,7 +16,11 @@ import io.opentelemetry.instrumentation.testing.util.TelemetryDataUtil import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier import io.opentelemetry.sdk.metrics.data.MetricData import io.opentelemetry.sdk.trace.data.SpanData +import java.util.concurrent.TimeUnit +import org.junit.Rule +import org.junit.rules.Timeout import spock.lang.Specification + /** * Base class for test specifications that are shared between instrumentation libraries and agent. * The methods in this class are implemented by {@link AgentTestTrait} and @@ -25,6 +29,9 @@ import spock.lang.Specification abstract class InstrumentationSpecification extends Specification { abstract InstrumentationTestRunner testRunner() + @Rule + public Timeout testTimeout = new Timeout(10, TimeUnit.MINUTES) + def setupSpec() { testRunner().beforeTestClass() }