Skip to content

Commit 1d5e36a

Browse files
Fixing test
1 parent 731ec58 commit 1d5e36a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/elastic/authorization/ElasticInferenceServiceAuthorizationHandlerTests.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ public void testDoesNotAttempt_ToRetrieveAuthorization_IfBaseUrlIsNull() throws
8383
assertFalse(authResponse.isAuthorized());
8484

8585
var loggerArgsCaptor = ArgumentCaptor.forClass(String.class);
86-
verify(logger).warn(loggerArgsCaptor.capture());
87-
var message = loggerArgsCaptor.getValue();
88-
assertThat(message, is("The base URL for the authorization service is not valid, rejecting authorization."));
86+
verify(logger, times(2)).debug(loggerArgsCaptor.capture());
87+
var messages = loggerArgsCaptor.getAllValues();
88+
assertThat(messages.getFirst(), is("Retrieving authorization information from the Elastic Inference Service."));
89+
assertThat(messages.get(1), is("The base URL for the authorization service is not valid, rejecting authorization."));
8990
}
9091
}
9192

@@ -104,9 +105,10 @@ public void testDoesNotAttempt_ToRetrieveAuthorization_IfBaseUrlIsEmpty() throws
104105
assertFalse(authResponse.isAuthorized());
105106

106107
var loggerArgsCaptor = ArgumentCaptor.forClass(String.class);
107-
verify(logger).warn(loggerArgsCaptor.capture());
108-
var message = loggerArgsCaptor.getValue();
109-
assertThat(message, is("The base URL for the authorization service is not valid, rejecting authorization."));
108+
verify(logger, times(2)).debug(loggerArgsCaptor.capture());
109+
var messages = loggerArgsCaptor.getAllValues();
110+
assertThat(messages.getFirst(), is("Retrieving authorization information from the Elastic Inference Service."));
111+
assertThat(messages.get(1), is("The base URL for the authorization service is not valid, rejecting authorization."));
110112
}
111113
}
112114

0 commit comments

Comments
 (0)