[TEST] Verify that date math expressions work with security plugin

Original commit: elastic/x-pack-elasticsearch@d87c9fdb30
This commit is contained in:
javanna 2016-10-20 12:07:26 +02:00 committed by Luca Cavanna
parent 8d001237df
commit b7a10239be
1 changed files with 5 additions and 1 deletions

View File

@ -97,6 +97,7 @@ public class DateMathExpressionIntegTests extends SecurityIntegTestCase {
} }
GetResponse getResponse = client.prepareGet(expression, "type", response.getId()).setFetchSource(true).get(); GetResponse getResponse = client.prepareGet(expression, "type", response.getId()).setFetchSource(true).get();
assertThat(getResponse.isExists(), is(true)); assertThat(getResponse.isExists(), is(true));
assertEquals("datemath-2016.10.01", getResponse.getIndex());
assertThat(getResponse.getSourceAsMap().get("foo").toString(), is("bar")); assertThat(getResponse.getSourceAsMap().get("foo").toString(), is("bar"));
assertThat(getResponse.getSourceAsMap().get("new").toString(), is("field")); assertThat(getResponse.getSourceAsMap().get("new").toString(), is("field"));
@ -104,7 +105,10 @@ public class DateMathExpressionIntegTests extends SecurityIntegTestCase {
MultiGetResponse multiGetResponse = client.prepareMultiGet() MultiGetResponse multiGetResponse = client.prepareMultiGet()
.add(expression, "type", response.getId()) .add(expression, "type", response.getId())
.get(); .get();
assertThat(multiGetResponse.getResponses()[0].getFailure().getMessage(), is("no such index")); assertFalse(multiGetResponse.getResponses()[0].isFailed());
assertTrue(multiGetResponse.getResponses()[0].getResponse().isExists());
assertEquals("datemath-2016.10.01", multiGetResponse.getResponses()[0].getResponse().getIndex());
DeleteIndexResponse deleteIndexResponse = client.admin().indices().prepareDelete(expression).get(); DeleteIndexResponse deleteIndexResponse = client.admin().indices().prepareDelete(expression).get();
assertThat(deleteIndexResponse.isAcknowledged(), is(true)); assertThat(deleteIndexResponse.isAcknowledged(), is(true));