Skip to content

Fix Test Optimization to work with JDK 24 #9114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import datadog.environment.JavaVirtualMachine
import datadog.trace.civisibility.CiVisibilitySmokeTest
import datadog.trace.util.ComparableVersion
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
Expand Down Expand Up @@ -84,42 +85,42 @@ class AbstractGradleTest extends CiVisibilitySmokeTest {
}

protected void givenGradleVersionIsCompatibleWithCurrentJvm(String gradleVersion) {
Assumptions.assumeTrue(isSupported(gradleVersion),
Assumptions.assumeTrue(isSupported(new ComparableVersion(gradleVersion)),
"Current JVM " + Jvm.current.javaVersion + " does not support Gradle version " + gradleVersion)
}

private static boolean isSupported(String gradleVersion) {
private static boolean isSupported(ComparableVersion gradleVersion) {
// https://docs.gradle.org/current/userguide/compatibility.html
if (Jvm.current.isJavaVersionCompatible(24)) {
return gradleVersion >= "8.14"
return gradleVersion.compareTo(new ComparableVersion("8.14")) >= 0
} else if (Jvm.current.java21Compatible) {
return gradleVersion >= "8.4"
return gradleVersion.compareTo(new ComparableVersion("8.4")) >= 0
} else if (Jvm.current.java20) {
return gradleVersion >= "8.1"
return gradleVersion.compareTo(new ComparableVersion("8.1")) >= 0
} else if (Jvm.current.java19) {
return gradleVersion >= "7.6"
return gradleVersion.compareTo(new ComparableVersion("7.6")) >= 0
} else if (Jvm.current.java18) {
return gradleVersion >= "7.5"
return gradleVersion.compareTo(new ComparableVersion("7.5")) >= 0
} else if (Jvm.current.java17) {
return gradleVersion >= "7.3"
return gradleVersion.compareTo(new ComparableVersion("7.3")) >= 0
} else if (Jvm.current.java16) {
return gradleVersion >= "7.0"
return gradleVersion.compareTo(new ComparableVersion("7.0")) >= 0
} else if (Jvm.current.java15) {
return gradleVersion >= "6.7"
return gradleVersion.compareTo(new ComparableVersion("6.7")) >= 0
} else if (Jvm.current.java14) {
return gradleVersion >= "6.3"
return gradleVersion.compareTo(new ComparableVersion("6.3")) >= 0
} else if (Jvm.current.java13) {
return gradleVersion >= "6.0"
return gradleVersion.compareTo(new ComparableVersion("6.0")) >= 0
} else if (Jvm.current.java12) {
return gradleVersion >= "5.4"
return gradleVersion.compareTo(new ComparableVersion("5.4")) >= 0
} else if (Jvm.current.java11) {
return gradleVersion >= "5.0"
return gradleVersion.compareTo(new ComparableVersion("5.0")) >= 0
} else if (Jvm.current.java10) {
return gradleVersion >= "4.7"
return gradleVersion.compareTo(new ComparableVersion("4.7")) >= 0
} else if (Jvm.current.java9) {
return gradleVersion >= "4.3"
return gradleVersion.compareTo(new ComparableVersion("4.3")) >= 0
} else if (Jvm.current.java8) {
return gradleVersion >= "2.0"
return gradleVersion.compareTo(new ComparableVersion("2.0")) >= 0
}
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ class GradleDaemonSmokeTest extends AbstractGradleTest {
"7.6.4" | "test-corrupted-config-legacy-instrumentation" | false | 1 | 0
}

@IgnoreIf(reason = "Failing on Java 24. Skip until we have a fix.", value = {
JavaVirtualMachine.isJavaVersionAtLeast(24)
})
def "test #projectName, v#gradleVersion, configCache: #configurationCache"() {
runGradleTest(gradleVersion, projectName, configurationCache, successExpected, flakyRetries, expectedTraces, expectedCoverages)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package datadog.smoketest

import datadog.environment.JavaVirtualMachine
import datadog.trace.api.Config
import datadog.trace.api.civisibility.CIConstants
import datadog.trace.api.config.CiVisibilityConfig
Expand All @@ -27,14 +26,10 @@ import org.slf4j.LoggerFactory
import org.w3c.dom.Document
import org.w3c.dom.NodeList
import spock.lang.AutoCleanup
import spock.lang.IgnoreIf
import spock.lang.Shared
import spock.lang.TempDir
import spock.util.environment.Jvm

@IgnoreIf(reason = "Failing on Java 24. Skip until we have a fix.", value = {
JavaVirtualMachine.isJavaVersionAtLeast(24)
})
class MavenSmokeTest extends CiVisibilitySmokeTest {

private static final Logger LOGGER = LoggerFactory.getLogger(MavenSmokeTest.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test.code_coverage.enabled" : "true",
"test.command" : "mvn -B test",
"test.framework" : "spock",
"test.framework_version" : "2.4.0-M2-groovy-4.0",
"test.framework_version" : "2.4.0-M6-groovy-4.0",
"test.status" : "pass",
"test.toolchain" : ${content_meta_test_toolchain},
"test.type" : "test",
Expand Down Expand Up @@ -66,7 +66,7 @@
"test.command" : "mvn -B test",
"test.execution" : "maven-surefire-plugin:test:default-test",
"test.framework" : "spock",
"test.framework_version" : "2.4.0-M2-groovy-4.0",
"test.framework_version" : "2.4.0-M6-groovy-4.0",
"test.module" : "Maven Smoke Tests Project maven-surefire-plugin default-test",
"test.status" : "pass",
"test.type" : "test",
Expand Down Expand Up @@ -298,7 +298,7 @@
"runtime.version" : ${content_meta_runtime_version},
"span.kind" : "test_suite_end",
"test.framework" : "spock",
"test.framework_version" : "2.4.0-M2-groovy-4.0",
"test.framework_version" : "2.4.0-M6-groovy-4.0",
"test.module" : "Maven Smoke Tests Project maven-surefire-plugin default-test",
"test.status" : "pass",
"test.suite" : "test_successful_maven_run_junit_platform_runner.src.test.groovy.SampleSpockTest",
Expand Down Expand Up @@ -350,7 +350,7 @@
"runtime.version" : ${content_meta_runtime_version},
"span.kind" : "test",
"test.framework" : "spock",
"test.framework_version" : "2.4.0-M2-groovy-4.0",
"test.framework_version" : "2.4.0-M6-groovy-4.0",
"test.module" : "Maven Smoke Tests Project maven-surefire-plugin default-test",
"test.name" : "test should pass",
"test.source.method" : "test should pass()V",
Expand Down Expand Up @@ -378,4 +378,4 @@
},
"type" : "test",
"version" : 2
} ]
} ]
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-bom</artifactId>
<version>2.4-M2-groovy-4.0</version>
<version>2.4-M6-groovy-4.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public final class ConfigDefaults {
static final boolean DEFAULT_CIVISIBILITY_BUILD_INSTRUMENTATION_ENABLED = true;
static final boolean DEFAULT_CIVISIBILITY_AUTO_CONFIGURATION_ENABLED = true;
static final boolean DEFAULT_CIVISIBILITY_COMPILER_PLUGIN_AUTO_CONFIGURATION_ENABLED = true;
static final String DEFAULT_CIVISIBILITY_COMPILER_PLUGIN_VERSION = "0.2.2";
static final String DEFAULT_CIVISIBILITY_JACOCO_PLUGIN_VERSION = "0.8.12";
static final String DEFAULT_CIVISIBILITY_COMPILER_PLUGIN_VERSION = "0.2.4";
static final String DEFAULT_CIVISIBILITY_JACOCO_PLUGIN_VERSION = "0.8.13";
static final String DEFAULT_CIVISIBILITY_JACOCO_PLUGIN_EXCLUDES =
"datadog.trace.*:org.apache.commons.*:org.mockito.*";
static final boolean DEFAULT_CIVISIBILITY_GIT_UPLOAD_ENABLED = true;
Expand Down
Loading