From 8527bc2415129ff744e5d9624585e1f311a70dc2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 22 Feb 2017 00:56:52 -0800 Subject: [PATCH] Build: Convert integ test dsl to new split cluster/runner dsl This is the xpack side of elastic/elasticsearch#23304 Original commit: elastic/x-pack-elasticsearch@8eddd7fb0d5caca252a49662fc91ce5de36b15f5 --- plugin/build.gradle | 69 +++++----- qa/audit-tests/build.gradle | 34 +++-- qa/core-rest-tests-with-security/build.gradle | 35 ++--- qa/ml-basic-multi-node/build.gradle | 14 +- qa/ml-disabled/build.gradle | 14 +- qa/ml-single-node-tests/build.gradle | 14 +- qa/reindex-tests-with-security/build.gradle | 56 ++++---- qa/rolling-upgrade/build.gradle | 93 ++++++++------ qa/security-client-tests/build.gradle | 35 ++--- qa/security-example-realm/build.gradle | 49 +++---- qa/security-migrate-tests/build.gradle | 46 ++++--- .../build.gradle | 38 +++--- .../build.gradle | 42 +++--- qa/smoke-test-plugins-ssl/build.gradle | 116 +++++++++-------- qa/smoke-test-plugins/build.gradle | 30 ++--- .../build.gradle | 34 +++-- .../build.gradle | 20 ++- .../build.gradle | 12 +- .../build.gradle | 41 +++--- qa/smoke-test-watcher/build.gradle | 42 +++--- qa/tribe-tests-with-license/build.gradle | 120 ++++++++---------- 21 files changed, 470 insertions(+), 484 deletions(-) diff --git a/plugin/build.gradle b/plugin/build.gradle index c9ba9065d06..124d4535c01 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -291,45 +291,46 @@ project.afterEvaluate { } } -integTest { +integTestRunner { // TODO: fix this rest test to not depend on a hardcoded port! systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*' - cluster { - setting 'xpack.ml.enabled', 'true' - setting 'xpack.monitoring.collection.interval', '3s' - waitCondition = { NodeInfo node, AntBuilder ant -> - File tmpFile = new File(node.cwd, 'wait.success') - for (int i = 0; i < 10; i++) { - // we use custom wait logic here as the elastic user is not available immediately and ant.get will fail when a 401 is returned - HttpURLConnection httpURLConnection = null; - try { - httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}/_cluster/health?wait_for_nodes=${numNodes}").openConnection(); - httpURLConnection.setRequestProperty("Authorization", "Basic " + - Base64.getEncoder().encodeToString("elastic:changeme".getBytes(StandardCharsets.UTF_8))); - httpURLConnection.setRequestMethod("GET"); - httpURLConnection.connect(); - if (httpURLConnection.getResponseCode() == 200) { - tmpFile.withWriter StandardCharsets.UTF_8.name(), { - it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name())) - } - } - } catch (Exception e) { - if (i == 9) { - logger.error("final attempt of calling cluster health failed", e) - } else { - logger.debug("failed to call cluster health", e) - } - } finally { - if (httpURLConnection != null) { - httpURLConnection.disconnect(); +} + +integTestCluster { + setting 'xpack.ml.enabled', 'true' + setting 'xpack.monitoring.collection.interval', '3s' + waitCondition = { NodeInfo node, AntBuilder ant -> + File tmpFile = new File(node.cwd, 'wait.success') + for (int i = 0; i < 10; i++) { + // we use custom wait logic here as the elastic user is not available immediately and ant.get will fail when a 401 is returned + HttpURLConnection httpURLConnection = null; + try { + httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}/_cluster/health?wait_for_nodes=${numNodes}").openConnection(); + httpURLConnection.setRequestProperty("Authorization", "Basic " + + Base64.getEncoder().encodeToString("elastic:changeme".getBytes(StandardCharsets.UTF_8))); + httpURLConnection.setRequestMethod("GET"); + httpURLConnection.connect(); + if (httpURLConnection.getResponseCode() == 200) { + tmpFile.withWriter StandardCharsets.UTF_8.name(), { + it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name())) } } - - // did not start, so wait a bit before trying again - Thread.sleep(500L); + } catch (Exception e) { + if (i == 9) { + logger.error("final attempt of calling cluster health failed", e) + } else { + logger.debug("failed to call cluster health", e) + } + } finally { + if (httpURLConnection != null) { + httpURLConnection.disconnect(); + } } - return tmpFile.exists() - } + + // did not start, so wait a bit before trying again + Thread.sleep(500L); + } + return tmpFile.exists() } } diff --git a/qa/audit-tests/build.gradle b/qa/audit-tests/build.gradle index e4697557734..5813bbca574 100644 --- a/qa/audit-tests/build.gradle +++ b/qa/audit-tests/build.gradle @@ -13,23 +13,21 @@ task copyXPackPluginProps(type: Copy) { } project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps) -integTest { - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.security.audit.enabled', 'true' - setting 'xpack.security.audit.outputs', 'index' - setting 'logger.level', 'DEBUG' - setupCommand 'setupDummyUser', - 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_user', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.security.audit.enabled', 'true' + setting 'xpack.security.audit.outputs', 'index' + setting 'logger.level', 'DEBUG' + setupCommand 'setupDummyUser', + 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_user', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/core-rest-tests-with-security/build.gradle b/qa/core-rest-tests-with-security/build.gradle index d2869225479..86ead2e5bc5 100644 --- a/qa/core-rest-tests-with-security/build.gradle +++ b/qa/core-rest-tests-with-security/build.gradle @@ -7,6 +7,9 @@ dependencies { integTest { includePackaged true +} + +integTestRunner { systemProperty 'tests.rest.blacklist', ['cat.aliases/10_basic/Empty cluster', 'index/10_with_id/Index with ID', @@ -15,22 +18,22 @@ integTest { 'cat.templates/10_basic/Sort templates', 'cat.templates/10_basic/Multiple template', ].join(',') +} - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.watcher.enabled', 'false' - setting 'xpack.monitoring.enabled', 'false' - setupCommand 'setupDummyUser', - 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_user', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.watcher.enabled', 'false' + setting 'xpack.monitoring.enabled', 'false' + setupCommand 'setupDummyUser', + 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_user', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/ml-basic-multi-node/build.gradle b/qa/ml-basic-multi-node/build.gradle index 4adbb6b568d..d3975a5f202 100644 --- a/qa/ml-basic-multi-node/build.gradle +++ b/qa/ml-basic-multi-node/build.gradle @@ -5,12 +5,10 @@ dependencies { testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'runtime') } -integTest { - cluster { - setting 'xpack.security.enabled', 'false' - setting 'xpack.ml.enabled', 'true' - numNodes = 3 - distribution = 'zip' - plugin ':x-pack-elasticsearch:plugin' - } +integTestCluster { + setting 'xpack.security.enabled', 'false' + setting 'xpack.ml.enabled', 'true' + numNodes = 3 + distribution = 'zip' + plugin ':x-pack-elasticsearch:plugin' } diff --git a/qa/ml-disabled/build.gradle b/qa/ml-disabled/build.gradle index 5ba892711c5..24617e3124e 100644 --- a/qa/ml-disabled/build.gradle +++ b/qa/ml-disabled/build.gradle @@ -5,12 +5,10 @@ dependencies { testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'runtime') } -integTest { - cluster { - setting 'xpack.security.enabled', 'false' - setting 'xpack.ml.enabled', 'false' - numNodes = 1 - distribution = 'zip' - plugin ':x-pack-elasticsearch:plugin' - } +integTestCluster { + setting 'xpack.security.enabled', 'false' + setting 'xpack.ml.enabled', 'false' + numNodes = 1 + distribution = 'zip' + plugin ':x-pack-elasticsearch:plugin' } diff --git a/qa/ml-single-node-tests/build.gradle b/qa/ml-single-node-tests/build.gradle index 5edadea1f0f..ae6c0374b21 100644 --- a/qa/ml-single-node-tests/build.gradle +++ b/qa/ml-single-node-tests/build.gradle @@ -6,12 +6,10 @@ dependencies { testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.6' } -integTest { - cluster { - setting 'xpack.security.enabled', 'false' - setting 'xpack.ml.enabled', 'true' - setting 'script.inline', 'true' - distribution = 'zip' - plugin ':x-pack-elasticsearch:plugin' - } +integTestCluster { + setting 'xpack.security.enabled', 'false' + setting 'xpack.ml.enabled', 'true' + setting 'script.inline', 'true' + distribution = 'zip' + plugin ':x-pack-elasticsearch:plugin' } diff --git a/qa/reindex-tests-with-security/build.gradle b/qa/reindex-tests-with-security/build.gradle index cc982e5e668..bbf8b0f0763 100644 --- a/qa/reindex-tests-with-security/build.gradle +++ b/qa/reindex-tests-with-security/build.gradle @@ -7,34 +7,32 @@ dependencies { testCompile project(path: ':modules:reindex') } -integTest { - cluster { - setting 'script.inline', 'true' - plugin ':x-pack-elasticsearch:plugin' - // Whitelist reindexing from the local node so we can test it. - setting 'reindex.remote.whitelist', '127.0.0.1:*' - extraConfigFile 'x-pack/roles.yml', 'roles.yml' - [ - test_admin: 'superuser', - powerful_user: 'superuser', - minimal_user: 'minimal', - readonly_user: 'readonly', - dest_only_user: 'dest_only', - can_not_see_hidden_docs_user: 'can_not_see_hidden_docs', - can_not_see_hidden_fields_user: 'can_not_see_hidden_fields', - ].each { String user, String role -> - setupCommand 'setupUser#' + user, - 'bin/x-pack/users', 'useradd', user, '-p', 'changeme', '-r', role - } - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_admin', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + setting 'script.inline', 'true' + plugin ':x-pack-elasticsearch:plugin' + // Whitelist reindexing from the local node so we can test it. + setting 'reindex.remote.whitelist', '127.0.0.1:*' + extraConfigFile 'x-pack/roles.yml', 'roles.yml' + [ + test_admin: 'superuser', + powerful_user: 'superuser', + minimal_user: 'minimal', + readonly_user: 'readonly', + dest_only_user: 'dest_only', + can_not_see_hidden_docs_user: 'can_not_see_hidden_docs', + can_not_see_hidden_fields_user: 'can_not_see_hidden_fields', + ].each { String user, String role -> + setupCommand 'setupUser#' + user, + 'bin/x-pack/users', 'useradd', user, '-p', 'changeme', '-r', role + } + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_admin', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index de6ec759495..237399976aa 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -51,56 +51,67 @@ String outputDir = "generated-resources/${project.name}" task oldClusterTest(type: RestIntegTestTask) { mustRunAfter(precommit) - cluster { - plugin ':x-pack-elasticsearch:plugin' - distribution = 'zip' - bwcVersion = '5.4.0-SNAPSHOT' // TODO: either randomize, or make this settable with sysprop - numBwcNodes = 2 - numNodes = 2 - clusterName = 'rolling-upgrade' - waitCondition = waitWithAuth - setting 'logger.org.elasticsearch.xpack.security', 'TRACE' - setting 'xpack.security.transport.ssl.enabled', 'true' - setting 'xpack.ssl.keystore.path', 'testnode.jks' - setting 'xpack.ssl.keystore.password', 'testnode' - extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks') - } - systemProperty 'tests.rest.suite', 'old_cluster' +} + +oldClusterTestCluster { + plugin ':x-pack-elasticsearch:plugin' + distribution = 'zip' + bwcVersion = '5.4.0-SNAPSHOT' // TODO: either randomize, or make this settable with sysprop + numBwcNodes = 2 + numNodes = 2 + clusterName = 'rolling-upgrade' + waitCondition = waitWithAuth + setting 'logger.org.elasticsearch.xpack.security', 'TRACE' + setting 'xpack.security.transport.ssl.enabled', 'true' + setting 'xpack.ssl.keystore.path', 'testnode.jks' + setting 'xpack.ssl.keystore.password', 'testnode' + extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks') +} +oldClusterTestRunner { + systemProperty 'tests.rest.suite', 'old_cluster' } task mixedClusterTest(type: RestIntegTestTask) { - dependsOn(oldClusterTest, 'oldClusterTest#node1.stop') - cluster { - plugin ':x-pack-elasticsearch:plugin' - distribution = 'zip' - clusterName = 'rolling-upgrade' - unicastTransportUri = { seedNode, node, ant -> oldClusterTest.nodes.get(0).transportUri() } - dataDir = "${-> oldClusterTest.nodes[1].dataDir}" - waitCondition = waitWithAuth - setting 'xpack.ssl.keystore.path', 'testnode.jks' - setting 'xpack.ssl.keystore.password', 'testnode' - extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks') - } + dependsOn(oldClusterTestRunner, 'oldClusterTestCluster#node1.stop') +} + +mixedClusterTestCluster { + plugin ':x-pack-elasticsearch:plugin' + distribution = 'zip' + clusterName = 'rolling-upgrade' + unicastTransportUri = { seedNode, node, ant -> oldClusterTest.nodes.get(0).transportUri() } + dataDir = "${-> oldClusterTest.nodes[1].dataDir}" + waitCondition = waitWithAuth + setting 'xpack.ssl.keystore.path', 'testnode.jks' + setting 'xpack.ssl.keystore.password', 'testnode' + extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks') +} + +mixedClusterTestRunner { systemProperty 'tests.rest.suite', 'mixed_cluster' - finalizedBy 'oldClusterTest#node0.stop' + finalizedBy 'oldClusterTestCluster#node0.stop' } task upgradedClusterTest(type: RestIntegTestTask) { - dependsOn(mixedClusterTest, 'oldClusterTest#node0.stop') - cluster { - plugin ':x-pack-elasticsearch:plugin' - distribution = 'zip' - clusterName = 'rolling-upgrade' - unicastTransportUri = { seedNode, node, ant -> mixedClusterTest.nodes.get(0).transportUri() } - dataDir = "${-> oldClusterTest.nodes[0].dataDir}" - waitCondition = waitWithAuth - setting 'xpack.ssl.keystore.path', 'testnode.jks' - setting 'xpack.ssl.keystore.password', 'testnode' - extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks') - } + dependsOn(mixedClusterTestRunner, 'oldClusterTestCluster#node0.stop') +} + +upgradedClusterTestCluster { + plugin ':x-pack-elasticsearch:plugin' + distribution = 'zip' + clusterName = 'rolling-upgrade' + unicastTransportUri = { seedNode, node, ant -> mixedClusterTest.nodes.get(0).transportUri() } + dataDir = "${-> oldClusterTest.nodes[0].dataDir}" + waitCondition = waitWithAuth + setting 'xpack.ssl.keystore.path', 'testnode.jks' + setting 'xpack.ssl.keystore.password', 'testnode' + extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks') +} + +upgradedClusterTestRunner { systemProperty 'tests.rest.suite', 'upgraded_cluster' // only need to kill the mixed cluster tests node here because we explicitly told it to not stop nodes upon completion - finalizedBy 'mixedClusterTest#stop' + finalizedBy 'mixedClusterTestCluster#stop' } task integTest { diff --git a/qa/security-client-tests/build.gradle b/qa/security-client-tests/build.gradle index 28675ac2f81..f5b84abd35b 100644 --- a/qa/security-client-tests/build.gradle +++ b/qa/security-client-tests/build.gradle @@ -14,23 +14,24 @@ task copyXPackPluginProps(type: Copy) { } project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps) -integTest { +integTestRunner { systemProperty 'tests.security.manager', 'false' - cluster { - plugin ':x-pack-elasticsearch:plugin' - setupCommand 'setupDummyUser', - 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' - setupCommand 'setupTransportClientUser', - 'bin/x-pack/users', 'useradd', 'transport', '-p', 'changeme', '-r', 'transport_client' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_user', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +} + +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setupCommand 'setupDummyUser', + 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' + setupCommand 'setupTransportClientUser', + 'bin/x-pack/users', 'useradd', 'transport', '-p', 'changeme', '-r', 'transport_client' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_user', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/security-example-realm/build.gradle b/qa/security-example-realm/build.gradle index 824815adca8..0dbe76d0f79 100644 --- a/qa/security-example-realm/build.gradle +++ b/qa/security-example-realm/build.gradle @@ -44,30 +44,33 @@ task buildZip(type:Zip, dependsOn: [jar]) { } task integTest(type: org.elasticsearch.gradle.test.RestIntegTestTask, dependsOn: buildZip) { - systemProperty 'tests.security.manager', 'false' - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.security.authc.realms.custom.order', '0' - setting 'xpack.security.authc.realms.custom.type', 'custom' - setting 'xpack.security.authc.realms.custom.filtered_setting', 'should be filtered' - setting 'xpack.security.authc.realms.esusers.order', '1' - setting 'xpack.security.authc.realms.esusers.type', 'file' + mustRunAfter precommit +} - setupCommand 'setupDummyUser', - 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' - setupCommand 'installExtension', - 'bin/x-pack/extension', 'install', 'file:' + buildZip.archivePath - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_user', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestRunner { + systemProperty 'tests.security.manager', 'false' +} +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.security.authc.realms.custom.order', '0' + setting 'xpack.security.authc.realms.custom.type', 'custom' + setting 'xpack.security.authc.realms.custom.filtered_setting', 'should be filtered' + setting 'xpack.security.authc.realms.esusers.order', '1' + setting 'xpack.security.authc.realms.esusers.type', 'file' + + setupCommand 'setupDummyUser', + 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' + setupCommand 'installExtension', + 'bin/x-pack/extension', 'install', 'file:' + buildZip.archivePath + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_user', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } check.dependsOn integTest -integTest.mustRunAfter precommit diff --git a/qa/security-migrate-tests/build.gradle b/qa/security-migrate-tests/build.gradle index 91a0a1080e2..f0571798597 100644 --- a/qa/security-migrate-tests/build.gradle +++ b/qa/security-migrate-tests/build.gradle @@ -6,29 +6,27 @@ dependencies { testCompile project(path: ':x-pack-elasticsearch:transport-client', configuration: 'runtime') } -integTest { - cluster { - setting 'script.inline', 'true' - plugin ':x-pack-elasticsearch:plugin' - extraConfigFile 'x-pack/roles.yml', 'roles.yml' - [ - test_admin: 'superuser', - transport_user: 'superuser', - existing: 'superuser', - bob: 'actual_role' - ].each { String user, String role -> - setupCommand 'setupUser#' + user, - 'bin/x-pack/users', 'useradd', user, '-p', 'changeme', '-r', role - } - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_admin', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + setting 'script.inline', 'true' + plugin ':x-pack-elasticsearch:plugin' + extraConfigFile 'x-pack/roles.yml', 'roles.yml' + [ + test_admin: 'superuser', + transport_user: 'superuser', + existing: 'superuser', + bob: 'actual_role' + ].each { String user, String role -> + setupCommand 'setupUser#' + user, + 'bin/x-pack/users', 'useradd', user, '-p', 'changeme', '-r', role + } + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_admin', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/smoke-test-graph-with-security/build.gradle b/qa/smoke-test-graph-with-security/build.gradle index bc517a29df3..55739f7f555 100644 --- a/qa/smoke-test-graph-with-security/build.gradle +++ b/qa/smoke-test-graph-with-security/build.gradle @@ -14,25 +14,25 @@ task copyGraphRestTests(type: Copy) { integTest { dependsOn copyGraphRestTests +} - cluster { - plugin ':x-pack-elasticsearch:plugin' - extraConfigFile 'x-pack/roles.yml', 'roles.yml' - setupCommand 'setupTestAdminUser', - 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' - setupCommand 'setupGraphExplorerUser', - 'bin/x-pack/users', 'useradd', 'graph_explorer', '-p', 'changeme', '-r', 'graph_explorer' - setupCommand 'setupPowerlessUser', - 'bin/x-pack/users', 'useradd', 'no_graph_explorer', '-p', 'changeme', '-r', 'no_graph_explorer' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_admin', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + extraConfigFile 'x-pack/roles.yml', 'roles.yml' + setupCommand 'setupTestAdminUser', + 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' + setupCommand 'setupGraphExplorerUser', + 'bin/x-pack/users', 'useradd', 'graph_explorer', '-p', 'changeme', '-r', 'graph_explorer' + setupCommand 'setupPowerlessUser', + 'bin/x-pack/users', 'useradd', 'no_graph_explorer', '-p', 'changeme', '-r', 'no_graph_explorer' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_admin', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/smoke-test-monitoring-with-security/build.gradle b/qa/smoke-test-monitoring-with-security/build.gradle index 2f97f13ad28..2f2485a2d31 100644 --- a/qa/smoke-test-monitoring-with-security/build.gradle +++ b/qa/smoke-test-monitoring-with-security/build.gradle @@ -15,29 +15,29 @@ subprojects { integTest { dependsOn copyMonitoringRestTests + } - cluster { - systemProperty 'es.logger.level', 'TRACE' - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.monitoring.collection.interval', '3s' - extraConfigFile 'x-pack/roles.yml', '../roles.yml' - setupCommand 'setupTestAdminUser', - 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' - setupCommand 'setupMonitoredSystemUser', - 'bin/x-pack/users', 'useradd', 'monitoring_system', '-p', 'changeme', '-r', 'monitoring_system,monitoring_without_bulk' - setupCommand 'setupPowerlessUser', - 'bin/x-pack/users', 'useradd', 'not_monitoring_system', '-p', 'changeme', '-r', 'monitoring_without_bulk' + integTestCluster { + systemProperty 'es.logger.level', 'TRACE' + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.monitoring.collection.interval', '3s' + extraConfigFile 'x-pack/roles.yml', '../roles.yml' + setupCommand 'setupTestAdminUser', + 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' + setupCommand 'setupMonitoredSystemUser', + 'bin/x-pack/users', 'useradd', 'monitoring_system', '-p', 'changeme', '-r', 'monitoring_system,monitoring_without_bulk' + setupCommand 'setupPowerlessUser', + 'bin/x-pack/users', 'useradd', 'not_monitoring_system', '-p', 'changeme', '-r', 'monitoring_without_bulk' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_admin', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_admin', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } } diff --git a/qa/smoke-test-plugins-ssl/build.gradle b/qa/smoke-test-plugins-ssl/build.gradle index d409d387b93..90d747aeeeb 100644 --- a/qa/smoke-test-plugins-ssl/build.gradle +++ b/qa/smoke-test-plugins-ssl/build.gradle @@ -157,77 +157,75 @@ processTestResources.dependsOn( ext.pluginsCount = 1 // we install xpack explicitly project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each { subproj -> // need to get a non-decorated project object, so must re-lookup the project by path - integTest.cluster.plugin(subproj.path) + integTestCluster.plugin(subproj.path) pluginsCount += 1 } -integTest { - cluster { - setting 'xpack.monitoring.collection.interval', '3s' - setting 'xpack.monitoring.exporters._http.type', 'http' - setting 'xpack.monitoring.exporters._http.enabled', 'false' - setting 'xpack.monitoring.exporters._http.ssl.truststore.path', clientKeyStore.name - setting 'xpack.monitoring.exporters._http.ssl.truststore.password', 'keypass' - setting 'xpack.monitoring.exporters._http.auth.username', 'monitoring_agent' - setting 'xpack.monitoring.exporters._http.auth.password', 'changeme' +integTestCluster { + setting 'xpack.monitoring.collection.interval', '3s' + setting 'xpack.monitoring.exporters._http.type', 'http' + setting 'xpack.monitoring.exporters._http.enabled', 'false' + setting 'xpack.monitoring.exporters._http.ssl.truststore.path', clientKeyStore.name + setting 'xpack.monitoring.exporters._http.ssl.truststore.password', 'keypass' + setting 'xpack.monitoring.exporters._http.auth.username', 'monitoring_agent' + setting 'xpack.monitoring.exporters._http.auth.password', 'changeme' - setting 'xpack.security.http.ssl.enabled', 'true' - setting 'xpack.security.http.ssl.keystore.path', nodeKeystore.name - setting 'xpack.security.http.ssl.keystore.password', 'keypass' + setting 'xpack.security.http.ssl.enabled', 'true' + setting 'xpack.security.http.ssl.keystore.path', nodeKeystore.name + setting 'xpack.security.http.ssl.keystore.password', 'keypass' - plugin ':x-pack-elasticsearch:plugin' + plugin ':x-pack-elasticsearch:plugin' - // copy keystores into config/ - extraConfigFile nodeKeystore.name, nodeKeystore - extraConfigFile clientKeyStore.name, clientKeyStore + // copy keystores into config/ + extraConfigFile nodeKeystore.name, nodeKeystore + extraConfigFile clientKeyStore.name, clientKeyStore - setupCommand 'setupTestUser', - 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' - setupCommand 'setupMonitoringUser', - 'bin/x-pack/users', 'useradd', 'monitoring_agent', '-p', 'changeme', '-r', 'remote_monitoring_agent' + setupCommand 'setupTestUser', + 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' + setupCommand 'setupMonitoringUser', + 'bin/x-pack/users', 'useradd', 'monitoring_agent', '-p', 'changeme', '-r', 'remote_monitoring_agent' - waitCondition = { NodeInfo node, AntBuilder ant -> - File tmpFile = new File(node.cwd, 'wait.success') - KeyStore keyStore = KeyStore.getInstance("JKS"); - keyStore.load(clientKeyStore.newInputStream(), 'keypass'.toCharArray()); - KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - kmf.init(keyStore, 'keypass'.toCharArray()); - TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - tmf.init(keyStore); - SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); - sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom()); - for (int i = 0; i < 10; i++) { - // we use custom wait logic here for HTTPS - HttpsURLConnection httpURLConnection = null; - try { - httpURLConnection = (HttpsURLConnection) new URL("https://${node.httpUri()}/_cluster/health?wait_for_nodes=${numNodes}").openConnection(); - httpURLConnection.setSSLSocketFactory(sslContext.getSocketFactory()); - httpURLConnection.setRequestProperty("Authorization", "Basic " + - Base64.getEncoder().encodeToString("test_user:changeme".getBytes(StandardCharsets.UTF_8))); - httpURLConnection.setRequestMethod("GET"); - httpURLConnection.connect(); - if (httpURLConnection.getResponseCode() == 200) { - tmpFile.withWriter StandardCharsets.UTF_8.name(), { - it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name())) - } - } - } catch (IOException e) { - if (i == 9) { - logger.error("final attempt of calling cluster health failed", e) - } else { - logger.debug("failed to call cluster health", e) - } - } finally { - if (httpURLConnection != null) { - httpURLConnection.disconnect(); + waitCondition = { NodeInfo node, AntBuilder ant -> + File tmpFile = new File(node.cwd, 'wait.success') + KeyStore keyStore = KeyStore.getInstance("JKS"); + keyStore.load(clientKeyStore.newInputStream(), 'keypass'.toCharArray()); + KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + kmf.init(keyStore, 'keypass'.toCharArray()); + TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(keyStore); + SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); + sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom()); + for (int i = 0; i < 10; i++) { + // we use custom wait logic here for HTTPS + HttpsURLConnection httpURLConnection = null; + try { + httpURLConnection = (HttpsURLConnection) new URL("https://${node.httpUri()}/_cluster/health?wait_for_nodes=${numNodes}").openConnection(); + httpURLConnection.setSSLSocketFactory(sslContext.getSocketFactory()); + httpURLConnection.setRequestProperty("Authorization", "Basic " + + Base64.getEncoder().encodeToString("test_user:changeme".getBytes(StandardCharsets.UTF_8))); + httpURLConnection.setRequestMethod("GET"); + httpURLConnection.connect(); + if (httpURLConnection.getResponseCode() == 200) { + tmpFile.withWriter StandardCharsets.UTF_8.name(), { + it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name())) } } - - // did not start, so wait a bit before trying again - Thread.sleep(500L); + } catch (IOException e) { + if (i == 9) { + logger.error("final attempt of calling cluster health failed", e) + } else { + logger.debug("failed to call cluster health", e) + } + } finally { + if (httpURLConnection != null) { + httpURLConnection.disconnect(); + } } - return tmpFile.exists() + + // did not start, so wait a bit before trying again + Thread.sleep(500L); } + return tmpFile.exists() } } diff --git a/qa/smoke-test-plugins/build.gradle b/qa/smoke-test-plugins/build.gradle index c59e2f91bc3..4f87f4b30f7 100644 --- a/qa/smoke-test-plugins/build.gradle +++ b/qa/smoke-test-plugins/build.gradle @@ -10,26 +10,24 @@ dependencies { ext.pluginsCount = 1 // we install xpack explicitly project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each { subproj -> // need to get a non-decorated project object, so must re-lookup the project by path - integTest.cluster.plugin(subproj.path) + integTestCluster.plugin(subproj.path) pluginsCount += 1 } -integTest { - cluster { - plugin ':x-pack-elasticsearch:plugin' +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' - setupCommand 'setupDummyUser', - 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_user', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } + setupCommand 'setupDummyUser', + 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_user', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/smoke-test-security-with-mustache/build.gradle b/qa/smoke-test-security-with-mustache/build.gradle index 15734f2e181..df0bce53cef 100644 --- a/qa/smoke-test-security-with-mustache/build.gradle +++ b/qa/smoke-test-security-with-mustache/build.gradle @@ -6,23 +6,21 @@ dependencies { testCompile project(path: ':modules:lang-mustache', configuration: 'runtime') } -integTest { - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.watcher.enabled', 'false' - setting 'xpack.monitoring.enabled', 'false' - setting 'path.scripts', "${project.buildDir}/resources/test/templates" - setupCommand 'setupDummyUser', - 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_admin', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.watcher.enabled', 'false' + setting 'xpack.monitoring.enabled', 'false' + setting 'path.scripts', "${project.buildDir}/resources/test/templates" + setupCommand 'setupDummyUser', + 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_admin', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/smoke-test-watcher-with-mustache/build.gradle b/qa/smoke-test-watcher-with-mustache/build.gradle index 2da509ada36..b739da3ecad 100644 --- a/qa/smoke-test-watcher-with-mustache/build.gradle +++ b/qa/smoke-test-watcher-with-mustache/build.gradle @@ -6,15 +6,13 @@ dependencies { testCompile project(path: ':modules:lang-mustache', configuration: 'runtime') } -integTest { - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.security.enabled', 'false' - setting 'xpack.monitoring.enabled', 'false' - setting 'http.port', '9400' - setting 'script.inline', 'true' - setting 'script.stored', 'true' - // Need to allow more compilations per minute because of the integration tests - setting 'script.max_compilations_per_minute', '100' - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.security.enabled', 'false' + setting 'xpack.monitoring.enabled', 'false' + setting 'http.port', '9400' + setting 'script.inline', 'true' + setting 'script.stored', 'true' + // Need to allow more compilations per minute because of the integration tests + setting 'script.max_compilations_per_minute', '100' } diff --git a/qa/smoke-test-watcher-with-painless/build.gradle b/qa/smoke-test-watcher-with-painless/build.gradle index 4f361e15c7a..62e8b7c6cd2 100644 --- a/qa/smoke-test-watcher-with-painless/build.gradle +++ b/qa/smoke-test-watcher-with-painless/build.gradle @@ -6,11 +6,9 @@ dependencies { testCompile project(path: ':modules:lang-painless', configuration: 'runtime') } -integTest { - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'script.inline', 'true' - setting 'xpack.security.enabled', 'false' - setting 'xpack.monitoring.enabled', 'false' - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'script.inline', 'true' + setting 'xpack.security.enabled', 'false' + setting 'xpack.monitoring.enabled', 'false' } diff --git a/qa/smoke-test-watcher-with-security/build.gradle b/qa/smoke-test-watcher-with-security/build.gradle index 1bb8bee6fb3..18a83a9117f 100644 --- a/qa/smoke-test-watcher-with-security/build.gradle +++ b/qa/smoke-test-watcher-with-security/build.gradle @@ -14,28 +14,31 @@ task copyWatcherRestTests(type: Copy) { integTest { dependsOn copyWatcherRestTests +} + +integTestRunner { systemProperty 'tests.rest.blacklist', ['hijack/10_basic/*', 'getting_started/10_monitor_cluster_health/Getting started - Monitor cluster health'].join(',') +} - cluster { - plugin ':x-pack-elasticsearch:plugin' - extraConfigFile 'x-pack/roles.yml', 'roles.yml' - setupCommand 'setupTestAdminUser', - 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' - setupCommand 'setupWatcherManagerUser', - 'bin/x-pack/users', 'useradd', 'watcher_manager', '-p', 'changeme', '-r', 'watcher_manager' - setupCommand 'setupPowerlessUser', - 'bin/x-pack/users', 'useradd', 'powerless_user', '-p', 'changeme', '-r', 'crappy_role' - waitCondition = { node, ant -> - File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://${node.httpUri()}", - dest: tmpFile.toString(), - username: 'test_admin', - password: 'changeme', - ignoreerrors: true, - retries: 10) - return tmpFile.exists() - } +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + extraConfigFile 'x-pack/roles.yml', 'roles.yml' + setupCommand 'setupTestAdminUser', + 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' + setupCommand 'setupWatcherManagerUser', + 'bin/x-pack/users', 'useradd', 'watcher_manager', '-p', 'changeme', '-r', 'watcher_manager' + setupCommand 'setupPowerlessUser', + 'bin/x-pack/users', 'useradd', 'powerless_user', '-p', 'changeme', '-r', 'crappy_role' + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + ant.get(src: "http://${node.httpUri()}", + dest: tmpFile.toString(), + username: 'test_admin', + password: 'changeme', + ignoreerrors: true, + retries: 10) + return tmpFile.exists() } } diff --git a/qa/smoke-test-watcher/build.gradle b/qa/smoke-test-watcher/build.gradle index fdac6a09ea4..9556fe2bb90 100644 --- a/qa/smoke-test-watcher/build.gradle +++ b/qa/smoke-test-watcher/build.gradle @@ -17,28 +17,26 @@ ext { jiraProject = 'XWT' } -integTest { - cluster { - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.security.enabled', 'false' - setting 'xpack.monitoring.enabled', 'false' - setting 'http.port', '9400' - // Need to allow more compilations per minute because of the integration tests - setting 'script.max_compilations_per_minute', '100' +integTestCluster { + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.security.enabled', 'false' + setting 'xpack.monitoring.enabled', 'false' + setting 'http.port', '9400' + // Need to allow more compilations per minute because of the integration tests + setting 'script.max_compilations_per_minute', '100' - // - // JIRA integration test settings - // - // The integration tests use a JIRA account on elasticsearch.atlassian.net. This account - // has been created by Edward Sy [edward@elastic.co]. It uses the "XPACK WATCHER TEST" - // Jira project available at https://elasticsearch.atlassian.net/projects/XWT/issues/?filter=allopenissues - // and the "xpack-user@elastic.co" username which is also an internal Google Group. - setting 'xpack.notification.jira.account.test.url', jiraUrl - setting 'xpack.notification.jira.account.test.user', jiraUser - setting 'xpack.notification.jira.account.test.password', jiraPassword - setting 'xpack.notification.jira.account.test.issue_defaults.project.key', jiraProject - setting 'xpack.notification.jira.account.test.issue_defaults.labels', ['integration-tests', project.version] - } + // + // JIRA integration test settings + // + // The integration tests use a JIRA account on elasticsearch.atlassian.net. This account + // has been created by Edward Sy [edward@elastic.co]. It uses the "XPACK WATCHER TEST" + // Jira project available at https://elasticsearch.atlassian.net/projects/XWT/issues/?filter=allopenissues + // and the "xpack-user@elastic.co" username which is also an internal Google Group. + setting 'xpack.notification.jira.account.test.url', jiraUrl + setting 'xpack.notification.jira.account.test.user', jiraUser + setting 'xpack.notification.jira.account.test.password', jiraPassword + setting 'xpack.notification.jira.account.test.issue_defaults.project.key', jiraProject + setting 'xpack.notification.jira.account.test.issue_defaults.labels', ['integration-tests', project.version] } /** Clean up JIRA after tests: delete all created issues **/ @@ -53,7 +51,7 @@ task cleanJira(type: DefaultTask) { } } } -integTest.finalizedBy cleanJira +integTestRunner.finalizedBy cleanJira /** List all issues associated to a given Jira project **/ def jiraIssues(String projectKey) { diff --git a/qa/tribe-tests-with-license/build.gradle b/qa/tribe-tests-with-license/build.gradle index 4ca6ac04139..ce8765a4ab7 100644 --- a/qa/tribe-tests-with-license/build.gradle +++ b/qa/tribe-tests-with-license/build.gradle @@ -10,74 +10,62 @@ dependencies { testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts') } -List cluster1Nodes -task setupClusterOne(type: DefaultTask) { - mustRunAfter(precommit) - ClusterConfiguration cluster1Config = new ClusterConfiguration(project) - cluster1Config.clusterName = 'cluster1' - cluster1Config.setting('node.name', 'cluster1-node1') - // x-pack - cluster1Config.plugin(':x-pack-elasticsearch:plugin') - cluster1Config.setting('xpack.monitoring.enabled', false) - cluster1Config.setting('xpack.security.enabled', false) - cluster1Config.setting('xpack.watcher.enabled', false) - cluster1Config.setting('xpack.graph.enabled', false) +ClusterConfiguration cluster1Config = new ClusterConfiguration(project) +cluster1Config.clusterName = 'cluster1' +cluster1Config.setting('node.name', 'cluster1-node1') +// x-pack +cluster1Config.plugin(':x-pack-elasticsearch:plugin') +cluster1Config.setting('xpack.monitoring.enabled', false) +cluster1Config.setting('xpack.security.enabled', false) +cluster1Config.setting('xpack.watcher.enabled', false) +cluster1Config.setting('xpack.graph.enabled', false) - cluster1Nodes = ClusterFormationTasks.setup(project, setupClusterOne, cluster1Config) +List cluster1Nodes = ClusterFormationTasks.setup(project, 'clusterOne', integTestRunner, cluster1Config) + +ClusterConfiguration cluster2Config = new ClusterConfiguration(project) +cluster2Config.clusterName = 'cluster2' +cluster2Config.setting('node.name', 'cluster2-node1') +// x-pack +cluster2Config.plugin(':x-pack-elasticsearch:plugin') +cluster2Config.setting('xpack.monitoring.enabled', false) +cluster2Config.setting('xpack.monitoring.enabled', false) +cluster2Config.setting('xpack.security.enabled', false) +cluster2Config.setting('xpack.watcher.enabled', false) +cluster2Config.setting('xpack.graph.enabled', false) + +List cluster2Nodes = ClusterFormationTasks.setup(project, 'clusterTwo', integTestRunner, cluster2Config) + +integTestCluster { + setting 'node.name', 'tribe-node' + setting 'tribe.on_conflict', 'prefer_cluster1' + setting 'tribe.cluster1.cluster.name', 'cluster1' + setting 'tribe.cluster1.discovery.zen.ping.unicast.hosts', "'${-> cluster1Nodes.get(0).transportUri()}'" + setting 'tribe.cluster1.http.enabled', 'true' + setting 'tribe.cluster1.xpack.monitoring.enabled', false + setting 'tribe.cluster1.xpack.monitoring.enabled', false + setting 'tribe.cluster1.xpack.security.enabled', false + setting 'tribe.cluster1.xpack.watcher.enabled', false + setting 'tribe.cluster1.xpack.graph.enabled', false + setting 'tribe.cluster2.cluster.name', 'cluster2' + setting 'tribe.cluster2.discovery.zen.ping.unicast.hosts', "'${-> cluster2Nodes.get(0).transportUri()}'" + setting 'tribe.cluster2.http.enabled', 'true' + setting 'tribe.cluster2.xpack.monitoring.enabled', false + setting 'tribe.cluster2.xpack.monitoring.enabled', false + setting 'tribe.cluster2.xpack.security.enabled', false + setting 'tribe.cluster2.xpack.watcher.enabled', false + setting 'tribe.cluster2.xpack.graph.enabled', false + // x-pack + plugin ':x-pack-elasticsearch:plugin' + setting 'xpack.monitoring.enabled', false + setting 'xpack.monitoring.enabled', false + setting 'xpack.security.enabled', false + setting 'xpack.watcher.enabled', false + setting 'xpack.graph.enabled', false } -List cluster2Nodes - -task setupClusterTwo(type: DefaultTask) { - mustRunAfter(precommit) - ClusterConfiguration cluster2Config = new ClusterConfiguration(project) - cluster2Config.clusterName = 'cluster2' - cluster2Config.setting('node.name', 'cluster2-node1') - // x-pack - cluster2Config.plugin(':x-pack-elasticsearch:plugin') - cluster2Config.setting('xpack.monitoring.enabled', false) - cluster2Config.setting('xpack.monitoring.enabled', false) - cluster2Config.setting('xpack.security.enabled', false) - cluster2Config.setting('xpack.watcher.enabled', false) - cluster2Config.setting('xpack.graph.enabled', false) - - cluster2Nodes = ClusterFormationTasks.setup(project, setupClusterTwo, cluster2Config) -} - -integTest { - dependsOn(setupClusterOne, setupClusterTwo) - cluster { - setting 'node.name', 'tribe-node' - setting 'tribe.on_conflict', 'prefer_cluster1' - setting 'tribe.cluster1.cluster.name', 'cluster1' - setting 'tribe.cluster1.discovery.zen.ping.unicast.hosts', "'${-> cluster1Nodes.get(0).transportUri()}'" - setting 'tribe.cluster1.http.enabled', 'true' - setting 'tribe.cluster1.xpack.monitoring.enabled', false - setting 'tribe.cluster1.xpack.monitoring.enabled', false - setting 'tribe.cluster1.xpack.security.enabled', false - setting 'tribe.cluster1.xpack.watcher.enabled', false - setting 'tribe.cluster1.xpack.graph.enabled', false - setting 'tribe.cluster2.cluster.name', 'cluster2' - setting 'tribe.cluster2.discovery.zen.ping.unicast.hosts', "'${-> cluster2Nodes.get(0).transportUri()}'" - setting 'tribe.cluster2.http.enabled', 'true' - setting 'tribe.cluster2.xpack.monitoring.enabled', false - setting 'tribe.cluster2.xpack.monitoring.enabled', false - setting 'tribe.cluster2.xpack.security.enabled', false - setting 'tribe.cluster2.xpack.watcher.enabled', false - setting 'tribe.cluster2.xpack.graph.enabled', false - // x-pack - plugin ':x-pack-elasticsearch:plugin' - setting 'xpack.monitoring.enabled', false - setting 'xpack.monitoring.enabled', false - setting 'xpack.security.enabled', false - setting 'xpack.watcher.enabled', false - setting 'xpack.graph.enabled', false - } - systemProperty 'tests.cluster', "${-> cluster1Nodes.get(0).transportUri()}" - systemProperty 'tests.cluster2', "${-> cluster2Nodes.get(0).transportUri()}" - systemProperty 'tests.tribe', "${-> integTest.nodes.get(0).transportUri()}" - // need to kill the standalone nodes here - finalizedBy 'setupClusterOne#stop' - finalizedBy 'setupClusterTwo#stop' +integTestRunner { + systemProperty 'tests.cluster', "${-> cluster1Nodes.get(0).transportUri()}" + systemProperty 'tests.cluster2', "${-> cluster2Nodes.get(0).transportUri()}" + systemProperty 'tests.tribe', "${-> integTest.nodes.get(0).transportUri()}" }