Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2614,7 +2614,6 @@ public void onFailure(Exception e) {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/74278")
public void testCreateServiceAccountToken() throws IOException {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -2723,14 +2722,13 @@ public void onFailure(Exception e) {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/74278")
public void testGetServiceAccountCredentials() throws IOException {
RestHighLevelClient client = highLevelClient();
final CreateServiceAccountTokenRequest createServiceAccountTokenRequest =
new CreateServiceAccountTokenRequest("elastic", "fleet-server", "token1");
new CreateServiceAccountTokenRequest("elastic", "fleet-server", "token2");
final CreateServiceAccountTokenResponse createServiceAccountTokenResponse =
client.security().createServiceAccountToken(createServiceAccountTokenRequest, RequestOptions.DEFAULT);
assertThat(createServiceAccountTokenResponse.getName(), equalTo("token1"));
assertThat(createServiceAccountTokenResponse.getName(), equalTo("token2"));

{
// tag::get-service-account-credentials-request
Expand All @@ -2752,7 +2750,7 @@ public void testGetServiceAccountCredentials() throws IOException {
// end::get-service-account-credentials-response
assertThat(principal, equalTo("elastic/fleet-server"));
assertThat(serviceTokenInfos.size(), equalTo(1));
assertThat(tokenName, equalTo("token1"));
assertThat(tokenName, equalTo("token2"));
assertThat(tokenSource, equalTo("index"));
}

Expand Down Expand Up @@ -2786,7 +2784,7 @@ public void onFailure(Exception e) {
assertNotNull(future.actionGet());
assertThat(future.actionGet().getPrincipal(), equalTo("elastic/fleet-server"));
assertThat(future.actionGet().getServiceTokenInfos().size(), equalTo(1));
assertThat(future.actionGet().getServiceTokenInfos().get(0), equalTo(new ServiceTokenInfo("token1", "index")));
assertThat(future.actionGet().getServiceTokenInfos().get(0), equalTo(new ServiceTokenInfo("token2", "index")));
}
}

Expand Down