Browse Source

Suppress exception test should not count as advice failure (#9658)

Lauri Tulmin 1 year ago
parent
commit
0511f5f7c3

+ 8 - 0
testing-common/integration-tests/src/test/java/indy/IndyInstrumentationTest.java

@@ -8,12 +8,19 @@ package indy;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
+import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
+import io.opentelemetry.javaagent.testing.common.TestAgentListenerAccess;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 @SuppressWarnings({"unused", "MethodCanBeStatic"})
 public class IndyInstrumentationTest {
 
+  @RegisterExtension
+  static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
+
   private String privateField;
 
   // The following methods are instrumented by the IndyInstrumentationTestModule
@@ -92,6 +99,7 @@ public class IndyInstrumentationTest {
   @Test
   void testSuppressException() {
     assertThat(noExceptionPlease("foo")).isEqualTo("foo_no_exception");
+    assertThat(TestAgentListenerAccess.getAndResetAdviceFailureCount()).isEqualTo(2);
   }
 
   @Test