From c8de04ae1409519d77fda097bc420e6617cb3a98 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 3 Dec 2015 23:36:35 -0800 Subject: [PATCH] make smoke test plugins (and ssl) work again Original commit: elastic/x-pack-elasticsearch@3d2413823e3f8cc74fbf11adff154b8e7fa2db5a --- qa/smoke-test-plugins-ssl/build.gradle | 24 ++++++++++++++----- .../test/smoke_test_plugins_ssl/10_basic.yaml | 5 +--- qa/smoke-test-plugins/build.gradle | 16 +++++-------- .../test/smoke_test_plugins/10_basic.yaml | 2 +- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/qa/smoke-test-plugins-ssl/build.gradle b/qa/smoke-test-plugins-ssl/build.gradle index 30f361cd459..fd2dbf8750d 100644 --- a/qa/smoke-test-plugins-ssl/build.gradle +++ b/qa/smoke-test-plugins-ssl/build.gradle @@ -1,4 +1,5 @@ import org.elasticsearch.gradle.LoggedExec +import org.elasticsearch.gradle.MavenFilteringHack apply plugin: 'elasticsearch.rest-test' @@ -31,12 +32,11 @@ task createKey(type: LoggedExec) { sourceSets.test.resources.srcDir(keystore.parentFile) processTestResources.dependsOn(createKey) -// add ES plugins, this loop must be outside of a configuration closure, otherwise it may get executed multiple times -for (Project subproj : project.rootProject.subprojects) { - if (subproj.path.startsWith(':plugins:')) { - // need to get a non-decorated project object, so must re-lookup the project by path - integTest.clusterConfig.plugin(subproj.name, project(subproj.path)) - } +ext.pluginsCount = 4 // we install xplugins 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.name, project(subproj.path)) + pluginsCount += 1 } integTest { @@ -66,3 +66,15 @@ integTest { } } } + +ext.expansions = [ + 'expected.plugins.count': pluginsCount +] + +processTestResources { + from(sourceSets.test.resources.srcDirs) { + include '**/*.yaml' + inputs.properties(expansions) + MavenFilteringHack.filter(it, expansions) + } +} diff --git a/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/10_basic.yaml b/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/10_basic.yaml index bd331636b1d..32ff292d471 100644 --- a/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/10_basic.yaml +++ b/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/10_basic.yaml @@ -10,7 +10,4 @@ - do: nodes.info: {} - - match: { nodes.$master.plugins.13.name: license } - - match: { nodes.$master.plugins.17.name: marvel-agent } - - match: { nodes.$master.plugins.20.name: shield } - - match: { nodes.$master.plugins.23.name: watcher } + - length: { nodes.$master.plugins: ${expected.plugins.count} } diff --git a/qa/smoke-test-plugins/build.gradle b/qa/smoke-test-plugins/build.gradle index a3deb67646c..fa1513a9ccc 100644 --- a/qa/smoke-test-plugins/build.gradle +++ b/qa/smoke-test-plugins/build.gradle @@ -6,17 +6,13 @@ dependencies { testCompile project(path: ':x-plugins:shield', configuration: 'runtime') } -ext.pluginCount = 0 -// this loop must be outside of a configuration closure, otherwise it may get executed multiple times -for (Project subproj : project.rootProject.subprojects) { - if (subproj.path.startsWith(':plugins:')) { - // need to get a non-decorated project object, so must re-lookup the project by path - integTest.clusterConfig.plugin(subproj.name, project(subproj.path)) - project.pluginCount += 1 - } +ext.pluginsCount = 4 // we install xplugins 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.name, project(subproj.path)) + pluginsCount += 1 } -project.pluginCount += 4 integTest { cluster { plugin 'licence', project(':x-plugins:license:plugin') @@ -40,7 +36,7 @@ integTest { } ext.expansions = [ - 'expected.plugin.count': pluginCount + 'expected.plugins.count': pluginsCount ] processTestResources { diff --git a/qa/smoke-test-plugins/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_basic.yaml b/qa/smoke-test-plugins/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_basic.yaml index f87af6475a4..b40101a819e 100644 --- a/qa/smoke-test-plugins/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_basic.yaml +++ b/qa/smoke-test-plugins/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_basic.yaml @@ -10,5 +10,5 @@ - do: nodes.info: {} - - length: { nodes.$master.plugins: ${expected.plugin.count} } + - length: { nodes.$master.plugins: ${expected.plugins.count} } # TODO: check that every plugin is installed