fix integration tests after reorganization

This commit fixes the integration tests and qa test after the reorganization to be
packaged as a single plugin.

Original commit: elastic/x-pack-elasticsearch@d6f488627f
This commit is contained in:
jaymode 2015-12-01 09:57:01 -05:00 committed by uboness
parent e1c1552eb2
commit 628febf3f7
41 changed files with 58 additions and 101 deletions

View File

@ -10,7 +10,7 @@ integTest {
systemProperty 'es.shield.audit.enabled', 'true'
systemProperty 'es.shield.audit.outputs', 'index'
setupCommand 'setupDummyUser',
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://localhost:${node.httpPort()}",

View File

@ -8,9 +8,9 @@ integTest {
cluster {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
setupCommand 'setupDummyUser',
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
setupCommand 'setupTransportClientUser',
'bin/shield/esusers', 'useradd', 'transport', '-p', 'changeme', '-r', 'transport_client'
'bin/x-pack/esusers', 'useradd', 'transport', '-p', 'changeme', '-r', 'transport_client'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://localhost:${node.httpPort()}",

View File

@ -6,6 +6,8 @@ dependencies {
integTest {
includePackaged true
systemProperty 'es.watcher.enabled', 'false'
systemProperty 'es.marvel.enabled', 'false'
systemProperty 'tests.rest.blacklist',
['indices.get/10_basic/*allow_no_indices*',
'cat.count/10_basic/Test cat count output',
@ -32,7 +34,7 @@ integTest {
cluster {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
setupCommand 'setupDummyUser',
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://localhost:${node.httpPort()}",

View File

@ -11,6 +11,7 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.client.support.Headers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.shield.authc.support.SecuredString;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.test.rest.RestTestCandidate;

View File

@ -23,7 +23,7 @@ integTest {
systemProperty 'es.shield.authc.realms.esusers.type', 'esusers'
setupCommand 'setupDummyUser',
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://localhost:${node.httpPort()}",

View File

@ -1,3 +1,5 @@
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.LoggedExec
apply plugin: 'elasticsearch.rest-test'
@ -32,13 +34,16 @@ 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
}
}
project.pluginCount += 1
integTest {
cluster {
// TODO: use some variable here for port number
@ -54,12 +59,24 @@ integTest {
// copy keystore into config/
extraConfigFile keystore.name, keystore
setupCommand 'setupTestUser',
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
setupCommand 'setupMarvelUser',
'bin/shield/esusers', 'useradd', 'marvel_export', '-p', 'changeme', '-r', 'marvel_agent'
'bin/x-pack/esusers', 'useradd', 'marvel_export', '-p', 'changeme', '-r', 'marvel_agent'
waitCondition = { node, ant ->
// we just return true, doing an https check is tricky here
return true
}
}
}
ext.expansions = [
'expected.plugin.count': pluginCount
]
processTestResources {
from(sourceSets.test.resources.srcDirs) {
exclude '**/*.jks'
inputs.properties(expansions)
MavenFilteringHack.filter(it, expansions)
}
}

View File

@ -10,7 +10,4 @@
- do:
nodes.info: {}
- match: { nodes.$master.plugins.15.name: license }
- match: { nodes.$master.plugins.19.name: marvel-agent }
- match: { nodes.$master.plugins.22.name: shield }
- match: { nodes.$master.plugins.25.name: watcher }
- length: { nodes.$master.plugins: ${expected.plugin.count} }

View File

@ -22,7 +22,7 @@ integTest {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
setupCommand 'setupDummyUser',
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://localhost:${node.httpPort()}",

View File

@ -10,5 +10,6 @@ integTest {
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

@ -8,7 +8,7 @@ dependencies {
task copyWatcherRestTests(type: Copy) {
into project.sourceSets.test.output.resourcesDir
from project(':x-plugins:elasticsearch:x-pack').sourceSets.test.resources.srcDirs
include 'rest-api-spec/test/**'
include 'rest-api-spec/test/watcher/**'
}
integTest {
@ -19,13 +19,13 @@ integTest {
cluster {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
extraConfigFile 'shield/roles.yml', 'roles.yml'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
setupCommand 'setupTestAdminUser',
'bin/shield/esusers', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'admin'
'bin/x-pack/esusers', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'admin'
setupCommand 'setupWatcherManagerUser',
'bin/shield/esusers', 'useradd', 'watcher_manager', '-p', 'changeme', '-r', 'watcher_manager'
'bin/x-pack/esusers', 'useradd', 'watcher_manager', '-p', 'changeme', '-r', 'watcher_manager'
setupCommand 'setupPowerlessUser',
'bin/shield/esusers', 'useradd', 'powerless_user', '-p', 'changeme', '-r', 'crapy_role'
'bin/x-pack/esusers', 'useradd', 'powerless_user', '-p', 'changeme', '-r', 'crapy_role'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://localhost:${node.httpPort()}",

View File

@ -5,6 +5,8 @@ esplugin {
name 'x-pack'
description 'Elasticsearch Expanded Pack Plugin'
classname 'org.elasticsearch.xpack.XPackPlugin'
// FIXME we still can't be isolated due to shield custom realms
isolated false
}
ext.versions = [
@ -116,4 +118,11 @@ bundlePlugin {
from('shield/bin/watcher') {
into 'bin'
}
integTest {
cluster {
// TODO set up tests so that shield can be enabled or disabled
systemProperty 'es.shield.enabled', 'false'
}
}
}

View File

@ -1,27 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.license.plugin.rest;
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.test.rest.RestTestCandidate;
import org.elasticsearch.test.rest.parser.RestTestParseException;
import java.io.IOException;
public class LicensesRestIT extends ESRestTestCase {
public LicensesRestIT(@Name("yaml") RestTestCandidate testCandidate) {
super(testCandidate);
}
@ParametersFactory
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
return ESRestTestCase.createParameters(0, 1);
}
}

View File

@ -1,27 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.marvel.rest;
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.test.rest.RestTestCandidate;
import org.elasticsearch.test.rest.parser.RestTestParseException;
import java.io.IOException;
public class MarvelRestIT extends ESRestTestCase {
public MarvelRestIT(@Name("yaml") RestTestCandidate testCandidate) {
super(testCandidate);
}
@ParametersFactory
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
return ESRestTestCase.createParameters(0, 1);
}
}

View File

@ -1,16 +0,0 @@
# Integration tests for Marvel plugin
#
"Marvel loaded":
- do:
cluster.state: {}
# Get master node id
- set: { master_node: master }
- do:
nodes.info: {}
- match: { nodes.$master.plugins.0.name: license }
- match: { nodes.$master.plugins.0.jvm: true }
- match: { nodes.$master.plugins.1.name: marvel-agent }
- match: { nodes.$master.plugins.1.jvm: true }

View File

@ -123,7 +123,7 @@ fi
export HOSTNAME=`hostname -s`
# include shield jars in classpath
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/shield/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/*"
cd "$ES_HOME" > /dev/null
"$JAVA" $ES_JAVA_OPTS -cp "$ES_CLASSPATH" -Des.path.home="$ES_HOME" $properties org.elasticsearch.shield.authc.esusers.tool.ESUsersTool "$@"

View File

@ -123,7 +123,7 @@ fi
export HOSTNAME=`hostname -s`
# include shield jars in classpath
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/shield/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/*"
cd "$ES_HOME" > /dev/null
$JAVA $ES_JAVA_OPTS -cp "$ES_CLASSPATH" -Des.path.home="$ES_HOME" $properties org.elasticsearch.shield.crypto.tool.SystemKeyTool "$@"

View File

@ -51,6 +51,7 @@ import org.elasticsearch.shield.transport.filter.IPFilter;
import org.elasticsearch.shield.transport.netty.ShieldNettyHttpServerTransport;
import org.elasticsearch.shield.transport.netty.ShieldNettyTransport;
import org.elasticsearch.transport.TransportModule;
import org.elasticsearch.xpack.XPackPlugin;
import java.nio.file.Path;
import java.util.*;
@ -319,7 +320,7 @@ public class ShieldPlugin extends Plugin {
}
public static Path configDir(Environment env) {
return env.configFile().resolve(NAME);
return env.configFile().resolve(XPackPlugin.NAME);
}
public static Path resolveConfigFile(Environment env, String name) {

View File

@ -3,14 +3,14 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.watcher.test.rest;
package org.elasticsearch.xpack.test.rest;
import org.elasticsearch.test.rest.RestTestCandidate;
/** Runs rest tests against external cluster */
public class WatcherRestIT extends WatcherRestTestCase {
public class XPackRestIT extends XPackRestTestCase {
public WatcherRestIT(RestTestCandidate testCandidate) {
public XPackRestIT(RestTestCandidate testCandidate) {
super(testCandidate);
}

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.watcher.test.rest;
package org.elasticsearch.xpack.test.rest;
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
@ -34,9 +34,9 @@ import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
@ESRestTestCase.Rest
@ClusterScope(scope = SUITE, numClientNodes = 1, transportClientRatio = 0, numDataNodes = 1, randomDynamicTemplates = false)
@TestLogging("_root:DEBUG")
public abstract class WatcherRestTestCase extends ESRestTestCase {
public abstract class XPackRestTestCase extends ESRestTestCase {
public WatcherRestTestCase(@Name("yaml") RestTestCandidate testCandidate) {
public XPackRestTestCase(@Name("yaml") RestTestCandidate testCandidate) {
super(testCandidate);
}

View File

@ -1,6 +1,6 @@
# Integration tests for License plugin
# Integration tests for Marvel plugin
#
"License loaded":
"X-Pack loaded":
- do:
cluster.state: {}
@ -10,6 +10,5 @@
- do:
nodes.info: {}
- match: { nodes.$master.plugins.0.name: license }
- match: { nodes.$master.plugins.0.name: x-pack }
- match: { nodes.$master.plugins.0.jvm: true }

View File

@ -114,7 +114,7 @@ fi
export HOSTNAME=`hostname -s`
# include watcher jars in classpath
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/watcher/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/*"
cd "$ES_HOME" > /dev/null
$JAVA $ES_JAVA_OPTS -cp "$ES_CLASSPATH" org.elasticsearch.watcher.trigger.schedule.tool.CronEvalTool "$@" $properties