Skip to content

Commit

Permalink
fix UT
Browse files Browse the repository at this point in the history
Signed-off-by: Peng Huo <penghuo@gmail.com>
  • Loading branch information
penghuo committed Oct 25, 2023
1 parent d2579a0 commit 50980fa
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,26 +327,6 @@ void testDispatchSelectQueryReuseSession() {
Assertions.assertEquals(MOCK_SESSION_ID, dispatchQueryResponse.getSessionId());
}

@Test
void testDispatchSelectQueryInvalidSession() {
String query = "select * from my_glue.default.http_logs";
DispatchQueryRequest queryRequest = dispatchQueryRequestWithSessionId(query, "invalid");

doReturn(true).when(sessionManager).isEnabled();
doReturn(Optional.empty()).when(sessionManager).getSession(any());
DataSourceMetadata dataSourceMetadata = constructMyGlueDataSourceMetadata();
when(dataSourceService.getRawDataSourceMetadata("my_glue")).thenReturn(dataSourceMetadata);
doNothing().when(dataSourceUserAuthorizationHelper).authorizeDataSource(dataSourceMetadata);
IllegalArgumentException exception =
Assertions.assertThrows(
IllegalArgumentException.class, () -> sparkQueryDispatcher.dispatch(queryRequest));

verifyNoInteractions(emrServerlessClient);
verify(sessionManager, never()).createSession(any());
Assertions.assertEquals(
"no session found. " + new SessionId("invalid"), exception.getMessage());
}

@Test
void testDispatchSelectQueryFailedCreateSession() {
String query = "select * from my_glue.default.http_logs";
Expand Down

0 comments on commit 50980fa

Please sign in to comment.