-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: redirect build failures on rabbit dlq #122
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,8 +63,7 @@ | |
import static org.gridsuite.shortcircuit.server.TestUtils.unzip; | ||
import static org.gridsuite.shortcircuit.server.service.ShortCircuitResultContext.HEADER_BUS_ID; | ||
import static org.gridsuite.shortcircuit.server.service.ShortCircuitWorkerService.COMPUTATION_TYPE; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.mockito.ArgumentMatchers.*; | ||
import static org.mockito.BDDMockito.given; | ||
import static org.mockito.Mockito.doAnswer; | ||
|
@@ -197,7 +196,7 @@ public String getVersion() { | |
private final String shortCircuitAnalysisRunDestination = "shortcircuitanalysis.run"; | ||
private final String shortCircuitAnalysisCancelDestination = "shortcircuitanalysis.cancel"; | ||
private final String shortCircuitAnalysisStoppedDestination = "shortcircuitanalysis.stopped"; | ||
private final String shortCircuitAnalysisFailedDestination = "shortcircuitanalysis.failed"; | ||
private final String shortCircuitAnalysisFailedDestination = "shortcircuitanalysis.run.dlx.dlq"; | ||
private final String shortCircuitAnalysisCancelFailedDestination = "shortcircuitanalysis.cancelfailed"; | ||
|
||
@Autowired | ||
|
@@ -665,11 +664,7 @@ void runWithBusBarSectionIdAndErrorTest() throws Exception { | |
assertEquals("me", runMessage.getHeaders().get("receiver")); | ||
assertEquals("BUSBARSECTION_ID_NOT_EXISTING", runMessage.getHeaders().get(HEADER_BUS_ID)); | ||
|
||
Message<byte[]> failedMessage = output.receive(TIMEOUT, shortCircuitAnalysisFailedDestination); | ||
assertEquals(RESULT_UUID.toString(), failedMessage.getHeaders().get("resultUuid")); | ||
assertEquals("me", failedMessage.getHeaders().get("receiver")); | ||
assertEquals("BUSBARSECTION_ID_NOT_EXISTING", failedMessage.getHeaders().get(HEADER_BUS_ID)); | ||
|
||
assertNull(output.receive(TIMEOUT, shortCircuitAnalysisResultDestination)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why can't we have the same message without the additional header? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check computationexception? |
||
mockMvc.perform(get( | ||
"/" + VERSION + "/results/{resultUuid}", RESULT_UUID)) | ||
.andExpect(status().isNotFound()); | ||
|
@@ -851,11 +846,10 @@ void runWithNoShortCircuitDataTest() throws Exception { | |
assertEquals(RESULT_UUID.toString(), runMessage.getHeaders().get("resultUuid")); | ||
assertEquals("me", runMessage.getHeaders().get("receiver")); | ||
|
||
//networkWithoutExtension has no shortcircuit data so the computation should fail | ||
Message<byte[]> resultMessage = output.receive(TIMEOUT, shortCircuitAnalysisFailedDestination); | ||
assertEquals("Short circuit analysis has failed : Missing short-circuit extension data", resultMessage.getHeaders().get("message")); | ||
assertEquals(RESULT_UUID.toString(), resultMessage.getHeaders().get("resultUuid")); | ||
assertEquals("me", resultMessage.getHeaders().get("receiver")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why can't we have the same message without the additional header? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check computationexception? |
||
assertNull(output.receive(TIMEOUT, shortCircuitAnalysisResultDestination)); | ||
mockMvc.perform(get( | ||
"/" + VERSION + "/results/{resultUuid}", RESULT_UUID)) | ||
.andExpect(status().isNotFound()); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
import com.powsybl.network.store.client.NetworkStoreService; | ||
import com.powsybl.network.store.client.PreloadingStrategy; | ||
import com.powsybl.shortcircuit.*; | ||
import com.powsybl.ws.commons.computation.ComputationException; | ||
import com.powsybl.ws.commons.computation.service.ExecutionService; | ||
import com.powsybl.ws.commons.computation.service.NotificationService; | ||
import com.powsybl.ws.commons.computation.service.ReportService; | ||
|
@@ -43,6 +44,7 @@ | |
import java.util.concurrent.CompletableFuture; | ||
import java.util.stream.Stream; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.mockito.ArgumentMatchers.*; | ||
import static org.mockito.Mockito.*; | ||
|
||
|
@@ -148,8 +150,7 @@ void testGetBusFaultFromOutOfVoltageBus() throws Exception { | |
try (var shortCircuitAnalysisMockedStatic = TestUtils.injectShortCircuitAnalysisProvider(analysisProvider); | ||
var shortCircuitResultContextMockedStatic = mockStatic(ShortCircuitResultContext.class)) { | ||
shortCircuitResultContextMockedStatic.when(() -> ShortCircuitResultContext.fromMessage(message, objectMapper)).thenReturn(resultContext); | ||
workerService.consumeRun().accept(message); | ||
verify(notificationService).publishFail(any(), any(), eq("Selected bus is out of voltage"), any(), any(), any()); | ||
assertThrows(ComputationException.class, () -> workerService.consumeRun().accept(message)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could keep checking "Selected bus is out of voltage" ? |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure we can remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because it is set in the run message already, so if it is defined in the run message it will be forwarded in the DLQ