add double restart test for local gateway
This commit is contained in:
parent
e340388a5d
commit
17cba798e6
|
@ -51,7 +51,60 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests {
|
||||||
closeAllNodes();
|
closeAllNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testSingleNode() throws Exception {
|
@Test public void testSingleNodeNoFlush() throws Exception {
|
||||||
|
buildNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
||||||
|
cleanAndCloseNodes();
|
||||||
|
|
||||||
|
Node node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").put("index.number_of_shards", 1).build());
|
||||||
|
node1.client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject().field("field", "value1").field("num", 1).endObject()).execute().actionGet();
|
||||||
|
node1.client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject().field("field", "value2").field("num", 2).endObject()).execute().actionGet();
|
||||||
|
|
||||||
|
node1.client().admin().indices().prepareRefresh().execute().actionGet();
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(2l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("field", "value1")).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("field", "value2")).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("num", 1)).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("num", 2)).execute().actionGet().count(), equalTo(1l));
|
||||||
|
}
|
||||||
|
|
||||||
|
closeNode("node1");
|
||||||
|
node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
||||||
|
|
||||||
|
logger.info("Running Cluster Health (wait for the shards to startup)");
|
||||||
|
ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet();
|
||||||
|
logger.info("Done Cluster Health, status " + clusterHealth.status());
|
||||||
|
assertThat(clusterHealth.timedOut(), equalTo(false));
|
||||||
|
assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.YELLOW));
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(2l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("field", "value1")).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("field", "value2")).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("num", 1)).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("num", 2)).execute().actionGet().count(), equalTo(1l));
|
||||||
|
}
|
||||||
|
|
||||||
|
closeNode("node1");
|
||||||
|
node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
||||||
|
|
||||||
|
logger.info("Running Cluster Health (wait for the shards to startup)");
|
||||||
|
clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet();
|
||||||
|
logger.info("Done Cluster Health, status " + clusterHealth.status());
|
||||||
|
assertThat(clusterHealth.timedOut(), equalTo(false));
|
||||||
|
assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.YELLOW));
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(2l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("field", "value1")).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("field", "value2")).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("num", 1)).execute().actionGet().count(), equalTo(1l));
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(termQuery("num", 2)).execute().actionGet().count(), equalTo(1l));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test public void testSingleNodeWithFlush() throws Exception {
|
||||||
buildNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
buildNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
||||||
cleanAndCloseNodes();
|
cleanAndCloseNodes();
|
||||||
|
|
||||||
|
@ -75,6 +128,19 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests {
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
assertThat(node1.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(2l));
|
assertThat(node1.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(2l));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeNode("node1");
|
||||||
|
node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
||||||
|
|
||||||
|
logger.info("Running Cluster Health (wait for the shards to startup)");
|
||||||
|
clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet();
|
||||||
|
logger.info("Done Cluster Health, status " + clusterHealth.status());
|
||||||
|
assertThat(clusterHealth.timedOut(), equalTo(false));
|
||||||
|
assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.YELLOW));
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
assertThat(node1.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(2l));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testTwoNodeFirstNodeCleared() throws Exception {
|
@Test public void testTwoNodeFirstNodeCleared() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue