Tests: Improve BWC preconditions to error cleanly when wire formats differ.
closes #7966
This commit is contained in:
parent
f878f40ae5
commit
d35d125ad8
|
@ -81,9 +81,16 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti
|
|||
|
||||
private static File backwardsCompatibilityPath() {
|
||||
String path = System.getProperty(TESTS_BACKWARDS_COMPATIBILITY_PATH);
|
||||
if (path == null || path.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid Backwards tests location path:" + path);
|
||||
}
|
||||
String version = System.getProperty(TESTS_BACKWARDS_COMPATIBILITY_VERSION);
|
||||
if (path == null || path.isEmpty() || version == null || version.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid Backwards tests location path:" + path + " version: " + version);
|
||||
if (version == null || version.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid Backwards tests version:" + version);
|
||||
}
|
||||
if (Version.fromString(version).before(Version.CURRENT.minimumCompatibilityVersion())) {
|
||||
throw new IllegalArgumentException("Backcompat elasticsearch version must be same major version as current. " +
|
||||
"backcompat: " + version + ", current: " + Version.CURRENT.toString());
|
||||
}
|
||||
File file = new File(path, "elasticsearch-" + version);
|
||||
if (!file.exists()) {
|
||||
|
|
|
@ -586,16 +586,18 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
clearDisruptionScheme();
|
||||
final Scope currentClusterScope = getCurrentClusterScope();
|
||||
try {
|
||||
if (currentClusterScope != Scope.TEST) {
|
||||
MetaData metaData = client().admin().cluster().prepareState().execute().actionGet().getState().getMetaData();
|
||||
assertThat("test leaves persistent cluster metadata behind: " + metaData.persistentSettings().getAsMap(), metaData
|
||||
if (cluster() != null) {
|
||||
if (currentClusterScope != Scope.TEST) {
|
||||
MetaData metaData = client().admin().cluster().prepareState().execute().actionGet().getState().getMetaData();
|
||||
assertThat("test leaves persistent cluster metadata behind: " + metaData.persistentSettings().getAsMap(), metaData
|
||||
.persistentSettings().getAsMap().size(), equalTo(0));
|
||||
assertThat("test leaves transient cluster metadata behind: " + metaData.transientSettings().getAsMap(), metaData
|
||||
assertThat("test leaves transient cluster metadata behind: " + metaData.transientSettings().getAsMap(), metaData
|
||||
.transientSettings().getAsMap().size(), equalTo(0));
|
||||
}
|
||||
ensureClusterSizeConsistency();
|
||||
cluster().wipe(); // wipe after to make sure we fail in the test that didn't ack the delete
|
||||
cluster().assertAfterTest();
|
||||
}
|
||||
ensureClusterSizeConsistency();
|
||||
cluster().wipe(); // wipe after to make sure we fail in the test that didn't ack the delete
|
||||
cluster().assertAfterTest();
|
||||
} finally {
|
||||
if (currentClusterScope == Scope.TEST) {
|
||||
clearClusters(); // it is ok to leave persistent / transient cluster state behind if scope is TEST
|
||||
|
|
Loading…
Reference in New Issue