Skip to content

Commit

Permalink
Fix QueryUserIT and QueryApiKeyIT
Browse files Browse the repository at this point in the history
  • Loading branch information
albertzaharovits committed Jun 11, 2024
1 parent 18503c9 commit a7f84c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void testQuery() throws IOException {
// Search for fields outside of the allowlist fails
ResponseException responseException = assertQueryError(API_KEY_ADMIN_AUTH_HEADER, 400, """
{ "query": { "prefix": {"api_key_hash": "{PBKDF2}10000$"} } }""");
assertThat(responseException.getMessage(), containsString("Field [api_key_hash] is not allowed for API Key query"));
assertThat(responseException.getMessage(), containsString("Field [api_key_hash] is not allowed for querying"));

// Search for fields that are not allowed in Query DSL but used internally by the service itself
final String fieldName = randomFrom("doc_type", "api_key_invalidated", "invalidation_time");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ public void testQuery() throws IOException {
assertQueryError(TEST_USER_NO_READ_USERS_AUTH_HEADER, 403, """
{ "query": { "wildcard": {"name": "*prefix*"} } }""");

// Range query not supported
// Span term query not supported
assertQueryError(400, """
{"query":{"range":{"username":{"lt":"now"}}}}""");
{"query":{"span_term":{"username": "X"} } }""");

// IDs query not supported
// Fuzzy query not supported
assertQueryError(400, """
{ "query": { "ids": { "values": "abc" } } }""");
{ "query": { "fuzzy": { "username": "X" } } }""");

// Make sure we can't query reserved users
String reservedUsername = getReservedUsernameAndAssertExists();
Expand Down

0 comments on commit a7f84c8

Please sign in to comment.