Skip to content

Commit 296ad7f

Browse files
authored
Add kotlin exploration tests (#11921)
Add kotlin exploration tests use okhttp library with branch 5.3 and instrument all methods from package okhttp3/* Co-authored-by: jean-philippe.bempel <jean-philippe.bempel@datadoghq.com>
1 parent 77d92e4 commit 296ad7f

4 files changed

Lines changed: 108 additions & 1 deletion

File tree

.gitlab/exploration-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,17 @@ exploration-tests-line-jackson-databind:
103103
PROJECT: jackson-databind
104104
script:
105105
- ./run-exploration-tests.sh "line" "$PROJECT" "./mvnw verify" "include_${PROJECT}.txt" "exclude_line_$PROJECT.txt"
106+
107+
exploration-tests-method-okhttp:
108+
needs: [ build ]
109+
dependencies:
110+
- build
111+
<<: *common-exploration-tests
112+
variables:
113+
PROJECT: okhttp
114+
KUBERNETES_MEMORY_REQUEST: 8Gi
115+
KUBERNETES_MEMORY_LIMIT: 8Gi
116+
script:
117+
- sdk use java 17.0.10-tem
118+
- java -XshowSettings:system -version
119+
- ./run-exploration-tests.sh "method" "$PROJECT" "GRADLE_OPTS=-XX:ActiveProcessorCount=4 ./gradlew --max-workers 4 jvmTest -Dtest.java.version=11" "include_${PROJECT}.txt" "exclude_$PROJECT.txt"

dd-java-agent/agent-debugger/exploration-tests/Dockerfile.exploration-tests

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ COPY .sdkmanrc .
1010
RUN curl -s "https://get.sdkman.io" | bash
1111
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && \
1212
sdk env install && \
13+
sdk install java 17.0.10-tem && \
1314
sdk flush"
1415

1516
RUN mkdir exploration-tests
@@ -30,7 +31,7 @@ RUN cd jackson-core && git apply /exploration-tests/jackson-core_exploration-tes
3031
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && cd jackson-core && mvn verify -DskipTests=true"
3132
RUN git clone -b 2.16 https://github.com/FasterXML/jackson-databind.git
3233
COPY jackson-databind_exploration-tests.patch .
33-
# fix tests that are failing because too deep recrursion
34+
# fix tests that are failing because too deep recursion
3435
RUN cd jackson-databind && git apply /exploration-tests/jackson-databind_exploration-tests.patch
3536
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && cd jackson-databind && mvn verify -DskipTests=true"
3637

@@ -42,3 +43,8 @@ RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && cd jackson-databind && m
4243
#RUN git clone https://github.com/google/guava.git
4344
#RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && cd guava && mvn -B -P!standard-with-extra-repos verify -U -Dmaven.javadoc.skip=true -DskipTests=true"
4445

46+
# okhttp
47+
RUN git clone -b okhttp_5.3.x https://github.com/square/okhttp.git
48+
COPY okhttp_exploration-tests.patch .
49+
RUN cd okhttp && git apply /exploration-tests/okhttp_exploration-tests.patch
50+
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk use java 17.0.10-tem && cd okhttp && ./gradlew dependencies"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
okhttp3/*
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
diff --git a/okhttp/src/jvmTest/kotlin/okhttp3/FastFallbackTest.kt b/okhttp/src/jvmTest/kotlin/okhttp3/FastFallbackTest.kt
2+
index e50aa9820..f36561b03 100644
3+
--- a/okhttp/src/jvmTest/kotlin/okhttp3/FastFallbackTest.kt
4+
+++ b/okhttp/src/jvmTest/kotlin/okhttp3/FastFallbackTest.kt
5+
@@ -38,6 +38,7 @@ import okhttp3.internal.http2.ErrorCode
6+
import okhttp3.testing.Flaky
7+
import org.junit.jupiter.api.AfterEach
8+
import org.junit.jupiter.api.BeforeEach
9+
+import org.junit.jupiter.api.Disabled
10+
import org.junit.jupiter.api.Test
11+
import org.junit.jupiter.api.Timeout
12+
import org.junit.jupiter.api.extension.RegisterExtension
13+
@@ -55,6 +56,7 @@ import org.opentest4j.TestAbortedException
14+
* This test only runs on host machines that have both IPv4 and IPv6 addresses for localhost.
15+
*/
16+
@Timeout(30)
17+
+@Disabled
18+
class FastFallbackTest {
19+
@RegisterExtension
20+
val clientTestRule = OkHttpClientTestRule()
21+
diff --git a/okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt b/okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt
22+
index 22f1ceaf5..3df72113b 100644
23+
--- a/okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt
24+
+++ b/okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt
25+
@@ -50,6 +50,7 @@ import okio.GzipSink
26+
import okio.Sink
27+
import okio.Source
28+
import okio.buffer
29+
+import org.junit.jupiter.api.Disabled
30+
import org.junit.jupiter.api.Tag
31+
import org.junit.jupiter.api.Test
32+
import org.junit.jupiter.api.extension.RegisterExtension
33+
@@ -608,11 +609,13 @@ class InterceptorTest {
34+
)
35+
}
36+
37+
+ @Disabled
38+
@Test
39+
fun applicationInterceptorThrowsRuntimeExceptionAsynchronous() {
40+
interceptorThrowsRuntimeExceptionAsynchronous(false)
41+
}
42+
43+
+ @Disabled
44+
@Test
45+
fun networkInterceptorThrowsRuntimeExceptionAsynchronous() {
46+
interceptorThrowsRuntimeExceptionAsynchronous(true)
47+
diff --git a/okhttp/src/jvmTest/kotlin/okhttp3/internal/tls/ClientAuthTest.kt b/okhttp/src/jvmTest/kotlin/okhttp3/internal/tls/ClientAuthTest.kt
48+
index d78fd43e1..5a3429050 100644
49+
--- a/okhttp/src/jvmTest/kotlin/okhttp3/internal/tls/ClientAuthTest.kt
50+
+++ b/okhttp/src/jvmTest/kotlin/okhttp3/internal/tls/ClientAuthTest.kt
51+
@@ -57,6 +57,7 @@ import okhttp3.tls.HeldCertificate
52+
import okhttp3.tls.internal.TlsUtil.newKeyManager
53+
import okhttp3.tls.internal.TlsUtil.newTrustManager
54+
import org.junit.jupiter.api.BeforeEach
55+
+import org.junit.jupiter.api.Disabled
56+
import org.junit.jupiter.api.Tag
57+
import org.junit.jupiter.api.Test
58+
import org.junit.jupiter.api.extension.RegisterExtension
59+
@@ -310,6 +311,7 @@ class ClientAuthTest {
60+
}
61+
}
62+
63+
+ @Disabled
64+
@Test
65+
fun invalidClientAuthEvents() {
66+
server.enqueue(
67+
diff --git a/okhttp/src/jvmTest/kotlin/okhttp3/internal/ws/WebSocketReaderTest.kt b/okhttp/src/jvmTest/kotlin/okhttp3/internal/ws/WebSocketReaderTest.kt
68+
index d3f264333..22d709282 100644
69+
--- a/okhttp/src/jvmTest/kotlin/okhttp3/internal/ws/WebSocketReaderTest.kt
70+
+++ b/okhttp/src/jvmTest/kotlin/okhttp3/internal/ws/WebSocketReaderTest.kt
71+
@@ -32,6 +32,7 @@ import okio.ByteString.Companion.decodeHex
72+
import okio.ByteString.Companion.encodeUtf8
73+
import okio.ByteString.Companion.toByteString
74+
import org.junit.jupiter.api.AfterEach
75+
+import org.junit.jupiter.api.Disabled
76+
import org.junit.jupiter.api.Test
77+
78+
class WebSocketReaderTest {
79+
@@ -431,6 +432,7 @@ class WebSocketReaderTest {
80+
assertThat(count).isEqualTo(1988)
81+
}
82+
83+
+ @Disabled
84+
@Test fun clientWithCompressionCannotBeUsedAfterClose() {
85+
data.write("c107f248cdc9c90700".decodeHex()) // Hello
86+
clientReaderWithCompression.processNextFrame()

0 commit comments

Comments
 (0)