Skip to content

Commit e7a4704

Browse files
authoredJun 21, 2021
Move mock filter impl to testing package (#323)
* Move mock filter impl to testing package Signed-off-by: Pavol Loffay <p.loffay@gmail.com> * fmt Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
1 parent 10bd959 commit e7a4704

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed
 

‎smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootSmokeTest.java

-17
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
2121
import java.io.IOException;
2222
import java.util.ArrayList;
23-
import java.util.Collection;
2423
import java.util.jar.Attributes;
2524
import java.util.jar.JarFile;
2625
import okhttp3.Request;
@@ -148,20 +147,4 @@ public void get() throws IOException, InterruptedException {
148147
// Assertions.assertEquals(1, responseBodyAttributes.size());
149148
// Assertions.assertEquals("Hi!", responseBodyAttributes.get(0));
150149
}
151-
152-
@Test
153-
public void blocking() throws IOException {
154-
String url = String.format("http://localhost:%d/greeting", app.getMappedPort(8080));
155-
Request request = new Request.Builder().url(url).addHeader("mockblock", "true").get().build();
156-
Response response = client.newCall(request).execute();
157-
Collection<ExportTraceServiceRequest> traces = waitForTraces();
158-
159-
Assertions.assertEquals(403, response.code());
160-
Assertions.assertEquals(
161-
1,
162-
getSpanStream(traces)
163-
.flatMap(span -> span.getAttributesList().stream())
164-
.filter(attribute -> attribute.getKey().equals("hypertrace.mock.filter.result"))
165-
.count());
166-
}
167150
}

‎testing-common/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ dependencies {
3131
testFixturesImplementation("net.bytebuddy:byte-buddy:${versions["byte_buddy"]}")
3232
testFixturesImplementation("net.bytebuddy:byte-buddy-agent:${versions["byte_buddy"]}")
3333
testFixturesCompileOnly("com.google.auto.service:auto-service-annotations:1.0")
34+
testFixturesAnnotationProcessor("com.google.auto.service:auto-service:1.0")
3435
testFixturesImplementation("org.eclipse.jetty:jetty-server:8.0.0.v20110901")
3536
}

‎filter-api/src/main/java/org/hypertrace/agent/filter/mock/MockFilter.java renamed to ‎testing-common/src/testFixtures/java/org/hypertrace/agent/testing/mockfilter/MockFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.hypertrace.agent.filter.mock;
17+
package org.hypertrace.agent.testing.mockfilter;
1818

1919
import io.opentelemetry.api.trace.Span;
2020
import java.util.Map;

‎filter-api/src/main/java/org/hypertrace/agent/filter/mock/MockFilterProvider.java renamed to ‎testing-common/src/testFixtures/java/org/hypertrace/agent/testing/mockfilter/MockFilterProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.hypertrace.agent.filter.mock;
17+
package org.hypertrace.agent.testing.mockfilter;
1818

1919
import com.google.auto.service.AutoService;
2020
import org.hypertrace.agent.filter.api.Filter;

0 commit comments

Comments
 (0)
Please sign in to comment.