Test: mute testOldIndexes

Ensure greens times out often. See https://github.com/elastic/elasticsearch/issues/10434
This commit is contained in:
Boaz Leskes 2015-04-07 09:19:01 +02:00
parent 9c209e46be
commit 59d6bd8881
1 changed files with 25 additions and 27 deletions

View File

@ -58,13 +58,7 @@ import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.*;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.CoreMatchers.equalTo;
@ -101,9 +95,9 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
@Override
public Settings nodeSettings(int ord) {
return ImmutableSettings.builder()
.put(Node.HTTP_ENABLED, true) // for _upgrade
.put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) // disable merging so no segments will be upgraded
.build();
.put(Node.HTTP_ENABLED, true) // for _upgrade
.put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) // disable merging so no segments will be upgraded
.build();
}
void setupCluster() throws Exception {
@ -111,8 +105,8 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
Path dataDir = newTempDirPath(LifecycleScope.SUITE);
ImmutableSettings.Builder nodeSettings = ImmutableSettings.builder()
.put("path.data", dataDir.toAbsolutePath())
.put("node.master", false); // workaround for dangling index loading issue when node is master
.put("path.data", dataDir.toAbsolutePath())
.put("node.master", false); // workaround for dangling index loading issue when node is master
String loadingNode = internalCluster().startNode(nodeSettings.build());
Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, loadingNode).nodeDataPaths();
@ -167,10 +161,16 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
SortedSet<String> expectedVersions = new TreeSet<>();
for (java.lang.reflect.Field field : Version.class.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && field.getType() == Version.class) {
Version v = (Version)field.get(Version.class);
if (v.snapshot()) continue; // snapshots are unreleased, so there is no backcompat yet
if (v.onOrBefore(Version.V_0_20_6)) continue; // we can only test back one major lucene version
if (v.equals(Version.CURRENT)) continue; // the current version is always compatible with itself
Version v = (Version) field.get(Version.class);
if (v.snapshot()) {
continue; // snapshots are unreleased, so there is no backcompat yet
}
if (v.onOrBefore(Version.V_0_20_6)) {
continue; // we can only test back one major lucene version
}
if (v.equals(Version.CURRENT)) {
continue; // the current version is always compatible with itself
}
expectedVersions.add("index-" + v.toString() + ".zip");
}
@ -190,6 +190,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
}
}
@LuceneTestCase.AwaitsFix(bugUrl = "times out often , see : https://github.com/elastic/elasticsearch/issues/10434")
public void testOldIndexes() throws Exception {
setupCluster();
@ -198,7 +199,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
long startTime = System.currentTimeMillis();
logger.info("--> Testing old index " + index);
assertOldIndexWorks(index);
logger.info("--> Done testing " + index + ", took " + ((System.currentTimeMillis() - startTime)/1000.0) + " seconds");
logger.info("--> Done testing " + index + ", took " + ((System.currentTimeMillis() - startTime) / 1000.0) + " seconds");
}
}
@ -209,10 +210,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
assertBasicSearchWorks(indexName);
assertBasicAggregationWorks(indexName);
assertRealtimeGetWorks(indexName);
if (version.equals(Version.V_0_90_13) == false) {
// norelease: 0.90.13 can take too long to create replicas, see https://github.com/elastic/elasticsearch/issues/10434
assertNewReplicasWork(indexName);
}
assertNewReplicasWork(indexName);
assertUpgradeWorks(indexName, isLatestLuceneVersion(version));
assertDeleteByQueryWorked(indexName, version);
unloadIndex(indexName);
@ -224,7 +222,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
boolean isLatestLuceneVersion(Version version) {
return version.luceneVersion.major == Version.CURRENT.luceneVersion.major &&
version.luceneVersion.minor == Version.CURRENT.luceneVersion.minor;
version.luceneVersion.minor == Version.CURRENT.luceneVersion.minor;
}
@ -280,8 +278,8 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
void assertRealtimeGetWorks(String indexName) {
assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder()
.put("refresh_interval", -1)
.build()));
.put("refresh_interval", -1)
.build()));
SearchRequestBuilder searchReq = client().prepareSearch(indexName).setQuery(QueryBuilders.matchAllQuery());
SearchHit hit = searchReq.get().getHits().getAt(0);
String docId = hit.getId();
@ -292,15 +290,15 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
assertThat(source, Matchers.hasKey("foo"));
assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder()
.put("refresh_interval", EngineConfig.DEFAULT_REFRESH_INTERVAL)
.build()));
.put("refresh_interval", EngineConfig.DEFAULT_REFRESH_INTERVAL)
.build()));
}
void assertNewReplicasWork(String indexName) throws Exception {
final int numReplicas = randomIntBetween(1, 2);
logger.debug("Creating [{}] replicas for index [{}]", numReplicas, indexName);
assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder()
.put("number_of_replicas", numReplicas)
.put("number_of_replicas", numReplicas)
).execute().actionGet());
ensureGreen(indexName);