Skip to content

Commit 2ce68fe

Browse files
[release/v1.32.x] Disable flaky test (#10384)
Co-authored-by: Lauri Tulmin <[email protected]>
1 parent 16adb1d commit 2ce68fe

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/build.gradle.kts

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ dependencies {
5959
}
6060

6161
tasks.withType<Test>().configureEach {
62+
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
63+
6264
// TODO run tests both with and without experimental span attributes
6365
jvmArgs("-Dotel.instrumentation.elasticsearch.experimental-span-attributes=true")
6466

instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ package springdata
77

88
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
99
import io.opentelemetry.semconv.SemanticAttributes
10+
import org.junit.jupiter.api.Assumptions
1011
import org.springframework.context.annotation.AnnotationConfigApplicationContext
1112
import spock.lang.Shared
13+
import spock.util.environment.Jvm
1214

1315
import java.lang.reflect.InvocationHandler
1416
import java.lang.reflect.Method
@@ -48,7 +50,7 @@ class Elasticsearch53SpringRepositoryTest extends AgentInstrumentationSpecificat
4850
}
4951

5052
void close() {
51-
applicationContext.close()
53+
applicationContext?.close()
5254
}
5355

5456
@Override
@@ -58,6 +60,9 @@ class Elasticsearch53SpringRepositoryTest extends AgentInstrumentationSpecificat
5860
}
5961

6062
def setup() {
63+
// when running on jdk 21 this test occasionally fails with timeout
64+
Assumptions.assumeTrue(Boolean.getBoolean("testLatestDeps") || !Jvm.getCurrent().isJava21Compatible())
65+
6166
repo.refresh()
6267
clearExportedData()
6368
runWithSpan("delete") {

instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ import org.elasticsearch.node.Node
1818
import org.elasticsearch.search.aggregations.bucket.nested.InternalNested
1919
import org.elasticsearch.search.aggregations.bucket.terms.Terms
2020
import org.elasticsearch.transport.Netty3Plugin
21+
import org.junit.jupiter.api.Assumptions
2122
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate
2223
import org.springframework.data.elasticsearch.core.ResultsExtractor
2324
import org.springframework.data.elasticsearch.core.query.IndexQueryBuilder
2425
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery
2526
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
2627
import spock.lang.Shared
28+
import spock.util.environment.Jvm
2729

2830
import java.util.concurrent.atomic.AtomicLong
2931

@@ -45,7 +47,6 @@ class Elasticsearch53SpringTemplateTest extends AgentInstrumentationSpecificatio
4547
ElasticsearchTemplate template
4648

4749
def setupSpec() {
48-
4950
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
5051
esWorkingDir.deleteOnExit()
5152
println "ES work dir: $esWorkingDir"
@@ -81,6 +82,11 @@ class Elasticsearch53SpringTemplateTest extends AgentInstrumentationSpecificatio
8182
}
8283
}
8384

85+
def setup() {
86+
// when running on jdk 21 this test occasionally fails with timeout
87+
Assumptions.assumeTrue(Boolean.getBoolean("testLatestDeps") || !Jvm.getCurrent().isJava21Compatible())
88+
}
89+
8490
def "test elasticsearch error"() {
8591
when:
8692
template.refresh(indexName)

0 commit comments

Comments
 (0)