use of org.openkilda.wfm.topology.flowhs.exception.DuplicateKeyException in project open-kilda by telstra.
the class YFlowCreateServiceTest method shouldFailOnErrorDuringDraftYFlowCreation.
@Test
public void shouldFailOnErrorDuringDraftYFlowCreation() throws RecoverableException, UnroutableFlowException, DuplicateKeyException {
// given
YFlowRequest request = buildYFlowRequest("test_failed_yflow", "test_flow_1", "test_flow_2").build();
YFlowRepository repository = setupYFlowRepositorySpy();
doThrow(new RuntimeException(injectedErrorMessage)).when(repository).add(ArgumentMatchers.argThat(argument -> argument.getYFlowId().equals(request.getYFlowId())));
preparePathComputation("test_flow_1", buildFirstSubFlowPathPair());
preparePathComputation("test_flow_2", buildSecondSubFlowPathPair());
prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT);
// when
processRequest(request);
// then
verifyNorthboundErrorResponse(yFlowCreateHubCarrier, ErrorType.INTERNAL_ERROR);
verifyNoSpeakerInteraction(yFlowCreateHubCarrier);
verifyYFlowIsAbsent(request.getYFlowId());
}
Aggregations