test: add 2.4.0 bwc index
Original commit: elastic/x-pack-elasticsearch@58bcf3abaf
This commit is contained in:
parent
836e1d3a28
commit
c5cde120b7
|
@ -15,6 +15,7 @@ import org.elasticsearch.common.io.FileSystemUtils;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.InternalTestCluster;
|
||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||
import org.elasticsearch.test.VersionUtils;
|
||||
import org.elasticsearch.xpack.security.action.role.GetRolesResponse;
|
||||
|
@ -30,6 +31,7 @@ import org.elasticsearch.xpack.security.user.User;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
@ -106,6 +108,15 @@ public class OldSecurityIndexBackwardsCompatibilityIT extends SecurityIntegTestC
|
|||
.put(settings).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int maxNumberOfNodes() {
|
||||
try {
|
||||
return SecurityIntegTestCase.defaultMaxNumberOfNodes() + loadIndexesList("x-pack", getBwcIndicesPath()).size();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("couldn't enumerate bwc indices", e);
|
||||
}
|
||||
}
|
||||
|
||||
void setupCluster(String pathToZipFile) throws Exception {
|
||||
// shutdown any nodes from previous zip files
|
||||
while (internalCluster().size() > 0) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
|
|||
//UnicastZen requires the number of nodes in a cluster to generate the unicast configuration.
|
||||
//The number of nodes is randomized though, but we can predict what the maximum number of nodes will be
|
||||
//and configure them all in unicast.hosts
|
||||
private static int maxNumberOfNodes() {
|
||||
protected static int defaultMaxNumberOfNodes() {
|
||||
ClusterScope clusterScope = SecurityIntegTestCase.class.getAnnotation(ClusterScope.class);
|
||||
if (clusterScope == null) {
|
||||
return InternalTestCluster.DEFAULT_HIGH_NUM_MASTER_NODES +
|
||||
|
@ -82,7 +82,17 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
|
|||
masterNodes = InternalTestCluster.DEFAULT_HIGH_NUM_MASTER_NODES;
|
||||
}
|
||||
|
||||
return masterNodes + clusterScope.maxNumDataNodes() + clientNodes;
|
||||
int dataNodes = 0;
|
||||
if (clusterScope.numDataNodes() < 0) {
|
||||
if (clusterScope.maxNumDataNodes() < 0) {
|
||||
dataNodes = InternalTestCluster.DEFAULT_MAX_NUM_DATA_NODES;
|
||||
} else {
|
||||
dataNodes = clusterScope.maxNumDataNodes();
|
||||
}
|
||||
} else {
|
||||
dataNodes = clusterScope.numDataNodes();
|
||||
}
|
||||
return masterNodes + dataNodes + clientNodes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +119,7 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
|
|||
@BeforeClass
|
||||
public static void initDefaultSettings() {
|
||||
if (SECURITY_DEFAULT_SETTINGS == null) {
|
||||
SECURITY_DEFAULT_SETTINGS = new SecuritySettingsSource(maxNumberOfNodes(), randomBoolean(), createTempDir(), Scope.SUITE);
|
||||
SECURITY_DEFAULT_SETTINGS = new SecuritySettingsSource(defaultMaxNumberOfNodes(), randomBoolean(), createTempDir(), Scope.SUITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,6 +284,10 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
|
|||
return randomBoolean();
|
||||
}
|
||||
|
||||
protected int maxNumberOfNodes() {
|
||||
return defaultMaxNumberOfNodes();
|
||||
}
|
||||
|
||||
protected Class<? extends XPackPlugin> xpackPluginClass() {
|
||||
return SECURITY_DEFAULT_SETTINGS.xpackPluginClass();
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue