[TEST] customize test global cluster for REST tests only if REST tests are enabled
Closes elastic/elasticsearch#107 Original commit: elastic/x-pack-elasticsearch@55eea46460
This commit is contained in:
parent
0d702c2fbc
commit
6f4acfa93b
|
@ -5,8 +5,10 @@
|
|||
*/
|
||||
package org.elasticsearch.test;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
import com.carrotsearch.randomizedtesting.SysGlobals;
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
|
||||
import com.google.common.base.Charsets;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.io.Streams;
|
||||
|
@ -57,6 +59,20 @@ public class ShieldRestTests extends ElasticsearchRestTests {
|
|||
" '.*': ALL\n";
|
||||
|
||||
static {
|
||||
|
||||
TestGroup testGroup = Rest.class.getAnnotation(TestGroup.class);
|
||||
String sysProperty = TestGroup.Utilities.getSysProperty(Rest.class);
|
||||
boolean enabled;
|
||||
try {
|
||||
enabled = RandomizedTest.systemPropertyAsBoolean(sysProperty, testGroup.enabled());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Ignore malformed system property, disable the group if malformed though.
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
//customize the global cluster only if rest tests are enabled
|
||||
//not perfect but good enough as REST tests are supposed to be run only separately on CI
|
||||
if (enabled) {
|
||||
final byte[] key;
|
||||
try {
|
||||
key = InternalKeyService.generateKey();
|
||||
|
@ -139,6 +155,7 @@ public class ShieldRestTests extends ElasticsearchRestTests {
|
|||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ClassRule
|
||||
public static TemporaryFolder tmpFolder = new TemporaryFolder();
|
||||
|
|
Loading…
Reference in New Issue