From 922d36c2d7393560f0c90482413abd28efcbf18a Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 12:20:48 -0700 Subject: [PATCH] [Backport 2.x] Fixed testPluginInstalled test (#91) Fixed testPluginInstalled test (#90) * Fixed testPluginInstalled test * Fixed name * Removed plugin ordering --------- (cherry picked from commit b1fbe0b291ad2630897a54142e66db3b77f82813) Signed-off-by: Owais Kazi Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- build.gradle | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 06732a8b8..980cb11d9 100644 --- a/build.gradle +++ b/build.gradle @@ -162,7 +162,24 @@ task integTest(type: RestIntegTestTask) { } tasks.named("check").configure { dependsOn(integTest) } +def _numNodes = findProperty('numNodes') as Integer ?: 1 + integTest { + + doFirst { + // Tell the test JVM if the cluster JVM is running under a debugger so that tests can + // use longer timeouts for requests. + def isDebuggingCluster = getDebug() || System.getProperty("test.debug") != null + systemProperty 'cluster.debug', isDebuggingCluster + // Set number of nodes system property to be used in tests + systemProperty 'cluster.number_of_nodes', "${_numNodes}" + // There seems to be an issue when running multi node run or integ tasks with unicast_hosts + // not being written, the waitForAllConditions ensures it's written + getClusters().forEach { cluster -> + cluster.waitForAllConditions() + } + } + // The --debug-jvm command-line option makes the cluster debuggable; this makes the tests debuggable if (System.getProperty("test.debug") != null) { jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005' @@ -170,7 +187,19 @@ integTest { } testClusters.integTest { - testDistribution = "INTEG_TEST" + testDistribution = "ARCHIVE" + // Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1 + if (_numNodes > 1) numberOfNodes = _numNodes + // When running integration tests it doesn't forward the --debug-jvm to the cluster anymore + // i.e. we have to use a custom property to flag when we want to debug OpenSearch JVM + // since we also support multi node integration tests we increase debugPort per node + if (System.getProperty("opensearch.debug") != null) { + def debugPort = 5005 + nodes.forEach { node -> + node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=*:${debugPort}") + debugPort += 1 + } + } // This installs our plugin into the testClusters plugin(project.tasks.bundlePlugin.archiveFile)