Skip to content
Closed
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 @@ -79,13 +79,15 @@ void testStopCdc() throws IOException {
}

@Test
void testStopCdcWithException() throws IOException {
doThrow(new IOException("Error stopping CDC")).when(cdcService).stop();
void testStopCdcWithExceptionDoesNotExposeDiagnostic() throws IOException {
String sensitiveDiagnostic = "broker-password=secret-value at /srv/private/cdc.offsets";
doThrow(new IOException(sensitiveDiagnostic)).when(cdcService).stop();

ResponseEntity<String> response = cdcController.stopCdc();

assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertEquals("Error stopping CDC process: Error stopping CDC", response.getBody());
assertEquals("Error stopping CDC process", response.getBody());
assertFalse(response.getBody().contains(sensitiveDiagnostic));
verify(cdcService, times(1)).stop();
}

Expand Down
Loading