Test: fix test bug with incorrect date math expressions

Original commit: elastic/x-pack-elasticsearch@ff88e947cd
This commit is contained in:
jaymode 2017-04-14 08:19:38 -04:00
parent 6f352260d6
commit 492439fc70
1 changed files with 3 additions and 3 deletions

View File

@ -1109,8 +1109,8 @@ public class IndicesAndAliasesResolverTests extends ESTestCase {
public void testResolveDateMathExpression() { public void testResolveDateMathExpression() {
// make the user authorized // make the user authorized
final String pattern = randomBoolean() ? "<datetime-{now/M}" : "<datetime-{now/M}*"; final String pattern = randomBoolean() ? "<datetime-{now/M}>" : "<datetime-{now/M}*>";
String dateTimeIndex = indexNameExpressionResolver.resolveDateMathExpression("<datetime-{now/M}"); String dateTimeIndex = indexNameExpressionResolver.resolveDateMathExpression("<datetime-{now/M}>");
String[] authorizedIndices = new String[] { "bar", "bar-closed", "foofoobar", "foofoo", "missing", "foofoo-closed", dateTimeIndex}; String[] authorizedIndices = new String[] { "bar", "bar-closed", "foofoobar", "foofoo", "missing", "foofoo-closed", dateTimeIndex};
roleMap.put("role", new RoleDescriptor("role", null, roleMap.put("role", new RoleDescriptor("role", null,
new IndicesPrivileges[] { IndicesPrivileges.builder().indices(authorizedIndices).privileges("all").build() }, null)); new IndicesPrivileges[] { IndicesPrivileges.builder().indices(authorizedIndices).privileges("all").build() }, null));
@ -1121,7 +1121,7 @@ public class IndicesAndAliasesResolverTests extends ESTestCase {
} }
Set<String> indices = defaultIndicesResolver.resolve(request, metaData, buildAuthorizedIndices(user, SearchAction.NAME)); Set<String> indices = defaultIndicesResolver.resolve(request, metaData, buildAuthorizedIndices(user, SearchAction.NAME));
assertThat(indices.size(), equalTo(1)); assertThat(indices.size(), equalTo(1));
assertThat(request.indices()[0], equalTo(indexNameExpressionResolver.resolveDateMathExpression(pattern))); assertThat(request.indices()[0], equalTo(dateTimeIndex));
} }
public void testMissingDateMathExpressionIgnoreUnavailable() { public void testMissingDateMathExpressionIgnoreUnavailable() {