use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldInjectRetryToThrottlingWhenReceivedFailedRerouteResult.
@Test
public void shouldInjectRetryToThrottlingWhenReceivedFailedRerouteResult() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(false).rerouteError(new RerouteInProgressError()).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
FlowThrottlingData expected = getFlowThrottlingData(flow, CORRELATION_ID + " : retry #1 ignore_bw false").build();
expected.setRetryCounter(1);
assertEquals(expected, rerouteQueue.getThrottling());
verify(carrier).sendExtendTimeWindowEvent();
}
use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldInjectRetryToThrottlingWhenReceivedTimeout.
@Test
public void shouldInjectRetryToThrottlingWhenReceivedTimeout() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
rerouteQueueService.handleTimeout(CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
FlowThrottlingData expected = getFlowThrottlingData(flow, CORRELATION_ID + " : retry #1 ignore_bw false").build();
expected.setRetryCounter(1);
assertEquals(expected, rerouteQueue.getThrottling());
verify(carrier).sendExtendTimeWindowEvent();
}
use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldSendThrottledRequestOnFlushWindowEvent.
@Test
public void shouldSendThrottledRequestOnFlushWindowEvent() {
FlowThrottlingData throttling = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().throttling(throttling).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
rerouteQueueService.flushThrottling();
assertEquals(throttling, rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
FlowRerouteRequest expectedRequest = getFlowRerouteRequest(FLOW_ID, throttling);
verify(carrier).sendRerouteRequest(any(String.class), eq(expectedRequest));
}
use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldNotInjectRetryWhenRetryCountIsExceeded.
@Test
public void shouldNotInjectRetryWhenRetryCountIsExceeded() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
inProgress.setRetryCounter(4);
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
rerouteQueueService.handleTimeout(CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
}
use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldSendCorrectErrorMessageForManualRerouteRequestWhenAnotherRerouteIsInProgress.
@Test
public void shouldSendCorrectErrorMessageForManualRerouteRequestWhenAnotherRerouteIsInProgress() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, "another one").build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
FlowThrottlingData actual = getFlowThrottlingData(flow, CORRELATION_ID).build();
rerouteQueueService.processManualRequest(FLOW_ID, actual);
verify(carrier).emitFlowRerouteError(argThat(rerouteIsInProgressErrorData(FLOW_ID)));
}
Aggregations