Merge pull request elastic/elasticsearch#1086 from rjernst/jigsaw

Build: Changes to tests for modules in elasticsearch

Original commit: elastic/x-pack-elasticsearch@95e0c53939
This commit is contained in:
Ryan Ernst 2015-12-04 11:53:05 -08:00
commit ad36c3f0dd
8 changed files with 20 additions and 28 deletions

View File

@ -8,7 +8,7 @@ apply plugin: 'elasticsearch.standalone-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch:x-pack', configuration: 'testArtifacts')
testCompile project(path: ':plugins:lang-groovy', configuration: 'runtime')
testCompile project(path: ':modules:lang-groovy', configuration: 'runtime')
}
// TODO: remove this, its because gradle does not bring in plugin-metadata for lang-groovy

View File

@ -1,6 +1,7 @@
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.MavenFilteringHack
apply plugin: 'elasticsearch.rest-test'
@ -33,17 +34,13 @@ 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
ext.pluginCount = 0
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 = 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.name, project(subproj.path))
pluginsCount += 1
}
project.pluginCount += 1
integTest {
cluster {
// TODO: use some variable here for port number
@ -70,12 +67,12 @@ integTest {
}
ext.expansions = [
'expected.plugin.count': pluginCount
'expected.plugins.count': pluginsCount
]
processTestResources {
from(sourceSets.test.resources.srcDirs) {
exclude '**/*.jks'
include '**/*.yaml'
inputs.properties(expansions)
MavenFilteringHack.filter(it, expansions)
}

View File

@ -10,4 +10,4 @@
- do:
nodes.info: {}
- length: { nodes.$master.plugins: ${expected.plugin.count} }
- length: { nodes.$master.plugins: ${expected.plugins.count} }

View File

@ -6,17 +6,13 @@ dependencies {
testCompile project(path: ':x-plugins:elasticsearch:x-pack', 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 = 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.name, project(subproj.path))
pluginsCount += 1
}
project.pluginCount += 1
integTest {
cluster {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
@ -37,7 +33,7 @@ integTest {
}
ext.expansions = [
'expected.plugin.count': pluginCount
'expected.plugins.count': pluginsCount
]
processTestResources {

View File

@ -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

View File

@ -2,13 +2,12 @@ apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch:x-pack', configuration: 'runtime')
testCompile project(path: ':plugins:lang-groovy', configuration: 'runtime')
testCompile project(path: ':modules:lang-groovy', configuration: 'runtime')
}
integTest {
cluster {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
plugin 'groovy', project(':plugins:lang-groovy')
systemProperty 'es.script.inline', 'on'
systemProperty 'es.shield.enabled', 'false'
}

View File

@ -51,7 +51,7 @@ public class MarvelPluginTests extends MarvelIntegTestCase {
assertNotNull(nodeInfo.getPlugins());
boolean found = false;
for (PluginInfo plugin : nodeInfo.getPlugins().getInfos()) {
for (PluginInfo plugin : nodeInfo.getPlugins().getPluginInfos()) {
assertNotNull(plugin);
if (XPackPlugin.NAME.equals(plugin.getName())) {

View File

@ -126,7 +126,7 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
for (NodeInfo nodeInfo : nodeInfos) {
// TODO: disable this assertion for now, because the test framework randomly runs with mock plugins. Maybe we should run without mock plugins?
// assertThat(nodeInfo.getPlugins().getInfos(), hasSize(2));
Collection<String> pluginNames = nodeInfo.getPlugins().getInfos().stream().map(p -> p.getName()).collect(Collectors.toList());
Collection<String> pluginNames = nodeInfo.getPlugins().getPluginInfos().stream().map(p -> p.getName()).collect(Collectors.toList());
assertThat("plugin [" + XPackPlugin.NAME + "] not found in [" + pluginNames + "]", pluginNames.contains(XPackPlugin.NAME), is(true));
}
}