Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/multi_tenancy] Add missing test annotation and fix the failing test it hid #3118

Merged
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 @@ -639,10 +639,9 @@ public void testSearchDataObject_Exception() throws IOException {
.searchSourceBuilder(searchSourceBuilder)
.build();

ArgumentCaptor<SearchRequest> searchRequestCaptor = ArgumentCaptor.forClass(SearchRequest.class);
PlainActionFuture<SearchResponse> exceptionalFuture = PlainActionFuture.newFuture();
exceptionalFuture.onFailure(new UnsupportedOperationException("test"));
when(mockedClient.search(searchRequestCaptor.capture())).thenReturn(exceptionalFuture);
when(mockedClient.search(any(SearchRequest.class))).thenReturn(exceptionalFuture);

CompletableFuture<SearchDataObjectResponse> future = sdkClient
.searchDataObjectAsync(searchRequest, testThreadPool.executor(GENERAL_THREAD_POOL))
Expand Down Expand Up @@ -675,6 +674,7 @@ public void testSearchDataObject_NullTenantId() throws IOException {
assertEquals("Tenant ID is required when multitenancy is enabled.", cause.getMessage());
}

@Test
public void testSearchDataObject_NullTenantNoMultitenancy() throws IOException {
// Tests no status exception if multitenancy not enabled
SdkClient sdkClientNoTenant = new SdkClient(new LocalClusterIndicesClient(mockedClient, xContentRegistry), false);
Expand All @@ -686,7 +686,11 @@ public void testSearchDataObject_NullTenantNoMultitenancy() throws IOException {
// null tenant Id
.searchSourceBuilder(searchSourceBuilder)
.build();


PlainActionFuture<SearchResponse> exceptionalFuture = PlainActionFuture.newFuture();
exceptionalFuture.onFailure(new UnsupportedOperationException("test"));
when(mockedClient.search(any(SearchRequest.class))).thenReturn(exceptionalFuture);

CompletableFuture<SearchDataObjectResponse> future = sdkClientNoTenant
.searchDataObjectAsync(searchRequest, testThreadPool.executor(GENERAL_THREAD_POOL))
.toCompletableFuture();
Expand Down
Loading