From d26bad99d03832db85beea36bf0d3925901ad415 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Wed, 8 May 2024 16:21:57 -0400 Subject: [PATCH] More testing --- .../internal/test/rest/RestTestUtil.java | 8 +++ build-tools/build.gradle | 18 +++---- build.gradle | 12 ++++- modules/analysis-common/build.gradle | 52 +++++++++---------- 4 files changed, 54 insertions(+), 36 deletions(-) diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestUtil.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestUtil.java index 99c25b9e25703..0dd1679f04eba 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestUtil.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestUtil.java @@ -73,6 +73,10 @@ public static void setupYamlRestTestDependenciesDefaults(Project project, Source if (useNewTestClusters) { project.getDependencies().add(sourceSet.getImplementationConfigurationName(), project.project(":test:test-clusters")); } + + project.getDependencies().add(sourceSet.getImplementationConfigurationName(), "org.junit.vintage:junit-vintage-engine:5.8.1"); + project.getDependencies().add(sourceSet.getImplementationConfigurationName(), "org.junit.platform:junit-platform-launcher:1.8.1"); + project.getDependencies().add(sourceSet.getImplementationConfigurationName(), "org.junit.jupiter:junit-jupiter:5.8.1"); } } @@ -86,5 +90,9 @@ public static void setupJavaRestTestDependenciesDefaults(Project project, Source if (yamlTestRunnerProject != null) { project.getDependencies().add(sourceSet.getImplementationConfigurationName(), yamlTestRunnerProject); } + + project.getDependencies().add(sourceSet.getImplementationConfigurationName(), "org.junit.vintage:junit-vintage-engine:5.8.1"); + project.getDependencies().add(sourceSet.getImplementationConfigurationName(), "org.junit.platform:junit-platform-launcher:1.8.1"); + project.getDependencies().add(sourceSet.getImplementationConfigurationName(), "org.junit.jupiter:junit-jupiter:5.8.1"); } } diff --git a/build-tools/build.gradle b/build-tools/build.gradle index f650c2910c031..628c46dedbd07 100644 --- a/build-tools/build.gradle +++ b/build-tools/build.gradle @@ -166,16 +166,16 @@ tasks.withType(JavaCompile).configureEach { options.incremental = System.getenv("JENKINS_URL") == null && System.getenv("BUILDKITE_BUILD_URL") == null && System.getProperty("isCI") == null } -test { - useJUnitPlatform { - includeEngines 'junit-vintage' - } +// test { +// useJUnitPlatform { +// includeEngines 'junit-vintage' +// } - // distribution { - // enabled = true - // maxLocalExecutors = 0 - // } -} +// // distribution { +// // enabled = true +// // maxLocalExecutors = 0 +// // } +// } // tasks.register("integTest", Test) { // testClassesDirs = sourceSets.integTest.output.classesDirs diff --git a/build.gradle b/build.gradle index 16c6fce28fe4b..ca98e65afc1d4 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.internal.BaseInternalPluginBuildPlugin import org.elasticsearch.gradle.internal.ResolveAllDependencies import org.elasticsearch.gradle.internal.info.BuildParams +import org.elasticsearch.gradle.test.YamlRestTestPlugin import org.elasticsearch.gradle.util.GradleUtils import org.gradle.plugins.ide.eclipse.model.AccessRule import org.gradle.plugins.ide.eclipse.model.ProjectDependency @@ -338,8 +339,17 @@ allprojects { } apply plugin: 'elasticsearch.formatting' -} + ['yamlRestTest', 'javaRestTest'].each { taskName -> + maybeConfigure(project.tasks, taskName) { + it.useJUnitPlatform() + it.distribution { + enabled = true + maxLocalExecutors = 0 + } + } + } +} tasks.register("verifyBwcTestsEnabled") { doLast { diff --git a/modules/analysis-common/build.gradle b/modules/analysis-common/build.gradle index 573d7bb4c60f4..e68f3653c7d77 100644 --- a/modules/analysis-common/build.gradle +++ b/modules/analysis-common/build.gradle @@ -32,9 +32,9 @@ dependencies { testImplementation "org.junit.platform:junit-platform-launcher:1.8.1" testImplementation "org.junit.jupiter:junit-jupiter:5.8.1" - yamlRestTestImplementation "org.junit.vintage:junit-vintage-engine:5.8.1" - yamlRestTestImplementation "org.junit.platform:junit-platform-launcher:1.8.1" - yamlRestTestImplementation "org.junit.jupiter:junit-jupiter:5.8.1" + // yamlRestTestImplementation "org.junit.vintage:junit-vintage-engine:5.8.1" + // yamlRestTestImplementation "org.junit.platform:junit-platform-launcher:1.8.1" + // yamlRestTestImplementation "org.junit.jupiter:junit-jupiter:5.8.1" } tasks.named("yamlRestTestV7CompatTransform").configure { task -> @@ -44,31 +44,31 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task -> task.skipTest("search.query/50_queries_with_synonyms/Test common terms query with stacked tokens", "#42654 - `common` query throws an exception") } -test { - useJUnitPlatform() +// test { +// useJUnitPlatform() - // useJUnitPlatform { - // includeEngines 'junit-vintage' - // } +// // useJUnitPlatform { +// // includeEngines 'junit-vintage' +// // } - distribution { - enabled = true - maxLocalExecutors = 0 - } - // javaLauncher = javaToolchains.launcherFor { - // languageVersion = JavaLanguageVersion.of(18) - // } -} +// distribution { +// enabled = true +// maxLocalExecutors = 0 +// } +// // javaLauncher = javaToolchains.launcherFor { +// // languageVersion = JavaLanguageVersion.of(18) +// // } +// } tasks.named('yamlRestTest').configure { - testLogging { - outputs.upToDateWhen {false} - showStandardStreams = true - } - useJUnitPlatform() - distribution { - enabled = true - maxLocalExecutors = 0 - } - javaLauncher = javaToolchains.launcherFor { } + // testLogging { + // outputs.upToDateWhen {false} + // showStandardStreams = true + // } + // useJUnitPlatform() + // distribution { + // enabled = true + // maxLocalExecutors = 0 + // } + // javaLauncher = javaToolchains.launcherFor { } }