From 492439fc701b6d83bf5a44fbf12b22de5704ef83 Mon Sep 17 00:00:00 2001 From: jaymode Date: Fri, 14 Apr 2017 08:19:38 -0400 Subject: [PATCH] Test: fix test bug with incorrect date math expressions Original commit: elastic/x-pack-elasticsearch@ff88e947cd9e7aecba7651eaa303fea3a6cc2fb3 --- .../security/authz/IndicesAndAliasesResolverTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolverTests.java b/plugin/src/test/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolverTests.java index f43bd64120f..1e86d26b38e 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolverTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolverTests.java @@ -1109,8 +1109,8 @@ public class IndicesAndAliasesResolverTests extends ESTestCase { public void testResolveDateMathExpression() { // make the user authorized - final String pattern = randomBoolean() ? "" : ""; + String dateTimeIndex = indexNameExpressionResolver.resolveDateMathExpression(""); String[] authorizedIndices = new String[] { "bar", "bar-closed", "foofoobar", "foofoo", "missing", "foofoo-closed", dateTimeIndex}; roleMap.put("role", new RoleDescriptor("role", null, new IndicesPrivileges[] { IndicesPrivileges.builder().indices(authorizedIndices).privileges("all").build() }, null)); @@ -1121,7 +1121,7 @@ public class IndicesAndAliasesResolverTests extends ESTestCase { } Set indices = defaultIndicesResolver.resolve(request, metaData, buildAuthorizedIndices(user, SearchAction.NAME)); assertThat(indices.size(), equalTo(1)); - assertThat(request.indices()[0], equalTo(indexNameExpressionResolver.resolveDateMathExpression(pattern))); + assertThat(request.indices()[0], equalTo(dateTimeIndex)); } public void testMissingDateMathExpressionIgnoreUnavailable() {