Kaynağa Gözat

Remove no longer used HTTP client test case (#9816)

Mateusz Rzeszutek 1 yıl önce
ebeveyn
işleme
020e4abbf0

+ 0 - 17
testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy

@@ -22,7 +22,6 @@ import spock.lang.Requires
 import spock.lang.Shared
 import spock.lang.Unroll
 
-import static org.junit.jupiter.api.Assumptions.assumeFalse
 import static org.junit.jupiter.api.Assumptions.assumeTrue
 
 @Unroll
@@ -145,7 +144,6 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
       optionsBuilder.setTestHttps(HttpClientTest.this.testHttps())
       optionsBuilder.setTestCallback(HttpClientTest.this.testCallback())
       optionsBuilder.setTestCallbackWithParent(HttpClientTest.this.testCallbackWithParent())
-      optionsBuilder.setTestCallbackWithImplicitParent(HttpClientTest.this.testCallbackWithImplicitParent())
       optionsBuilder.setTestErrorWithCallback(HttpClientTest.this.testErrorWithCallback())
       optionsBuilder.setTestNonStandardHttpMethod(HttpClientTest.this.testNonStandardHttpMethod())
     }
@@ -228,7 +226,6 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
 
   def "trace request with callback and no parent"() {
     assumeTrue(testCallback())
-    assumeFalse(testCallbackWithImplicitParent())
     expect:
     try {
       junitTest.requestWithCallbackAndNoParent()
@@ -236,13 +233,6 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
     }
   }
 
-  def "trace request with callback and implicit parent"() {
-    assumeTrue(testCallback())
-    assumeTrue(testCallbackWithImplicitParent())
-    expect:
-    junitTest.requestWithCallbackAndImplicitParent()
-  }
-
   def "basic request with 1 redirect"() {
     assumeTrue(testRedirects())
     expect:
@@ -442,13 +432,6 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
     true
   }
 
-  boolean testCallbackWithImplicitParent() {
-    // depending on async behavior callback can be executed within
-    // parent span scope or outside of the scope, e.g. in reactor-netty or spring
-    // callback is correlated.
-    false
-  }
-
   boolean testErrorWithCallback() {
     return true
   }

+ 0 - 25
testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java

@@ -12,7 +12,6 @@ import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equal
 import static io.opentelemetry.semconv.SemanticAttributes.NetTransportValues.IP_TCP;
 import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.catchThrowable;
-import static org.junit.Assume.assumeFalse;
 import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import io.opentelemetry.api.common.AttributeKey;
@@ -223,7 +222,6 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
   @Test
   void requestWithCallbackAndNoParent() throws Throwable {
     assumeTrue(options.getTestCallback());
-    assumeFalse(options.getTestCallbackWithImplicitParent());
 
     String method = "GET";
     URI uri = resolveAddress("/success");
@@ -244,29 +242,6 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
                 span -> span.hasName("callback").hasKind(SpanKind.INTERNAL).hasNoParent()));
   }
 
-  @Test
-  void requestWithCallbackAndImplicitParent() throws Throwable {
-    assumeTrue(options.getTestCallbackWithImplicitParent());
-
-    String method = "GET";
-    URI uri = resolveAddress("/success");
-
-    HttpClientResult result =
-        doRequestWithCallback(method, uri, () -> testing.runWithSpan("callback", () -> {}));
-
-    assertThat(result.get()).isEqualTo(200);
-
-    testing.waitAndAssertTraces(
-        trace ->
-            trace.hasSpansSatisfyingExactly(
-                span -> assertClientSpan(span, uri, method, 200, null).hasNoParent(),
-                span -> assertServerSpan(span).hasParent(trace.getSpan(0)),
-                span ->
-                    span.hasName("callback")
-                        .hasKind(SpanKind.INTERNAL)
-                        .hasParent(trace.getSpan(0))));
-  }
-
   @Test
   void basicRequestWith1Redirect() throws Exception {
     assumeTrue(options.getTestRedirects());

+ 0 - 13
testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/HttpClientTestOptions.java

@@ -83,11 +83,6 @@ public abstract class HttpClientTestOptions {
 
   public abstract boolean getTestCallbackWithParent();
 
-  // depending on async behavior callback can be executed within
-  // parent span scope or outside of the scope, e.g. in reactor-netty or spring
-  // callback is correlated.
-  public abstract boolean getTestCallbackWithImplicitParent();
-
   public abstract boolean getTestErrorWithCallback();
 
   public abstract boolean getTestNonStandardHttpMethod();
@@ -118,7 +113,6 @@ public abstract class HttpClientTestOptions {
           .setTestHttps(true)
           .setTestCallback(true)
           .setTestCallbackWithParent(true)
-          .setTestCallbackWithImplicitParent(false)
           .setTestErrorWithCallback(true)
           .setTestNonStandardHttpMethod(true);
     }
@@ -157,8 +151,6 @@ public abstract class HttpClientTestOptions {
 
     Builder setTestCallbackWithParent(boolean value);
 
-    Builder setTestCallbackWithImplicitParent(boolean value);
-
     Builder setTestErrorWithCallback(boolean value);
 
     Builder setTestNonStandardHttpMethod(boolean value);
@@ -223,11 +215,6 @@ public abstract class HttpClientTestOptions {
       return setTestNonStandardHttpMethod(false);
     }
 
-    @CanIgnoreReturnValue
-    default Builder enableTestCallbackWithImplicitParent() {
-      return setTestCallbackWithImplicitParent(true);
-    }
-
     @CanIgnoreReturnValue
     default Builder markAsLowLevelInstrumentation() {
       return setInstrumentationType(HttpClientInstrumentationType.LOW_LEVEL);