Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Rework excpetion message while waiting for status
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-farache authored and openshift-merge-robot committed Jul 4, 2023
1 parent f69e564 commit 02c5d4f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class SimpleRestartWorkFlowTest {
private static final String WORKFLOW_NAME = "onboardingComplexAssessment" + WorkFlowConstants.ASSESSMENT_WORKFLOW;

@Test
public void runRestartNotExistingWorkFlow() {
public void runRestartNotExistingWorkFlow() throws InterruptedException {
TestComponents components = new WorkFlowTestBuilder().withDefaultProject().withWorkFlowDefinition(WORKFLOW_NAME)
.build();
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
Expand All @@ -49,11 +49,12 @@ public void runRestartNotExistingWorkFlow() {
assertThat(assertThrows(ApiException.class, () -> workflowApi.restartWorkFlow(execId)))
.hasMessageContaining(String.format("Workflow execution with ID: %s not found", execId))
.hasMessageContaining("HTTP response code: 404");
Thread.sleep(2000);

}

@Test
public void runRestartWorkFlow() throws ApiException {
public void runRestartWorkFlow() throws ApiException, InterruptedException {
log.info("******** Running the assessment workFlow ********");
TestComponents components = new WorkFlowTestBuilder().withDefaultProject().withWorkFlowDefinition(WORKFLOW_NAME)
.build();
Expand Down Expand Up @@ -87,11 +88,12 @@ public void runRestartWorkFlow() throws ApiException {
log.info("The Following Option Is Available after restart: {}", infrastructureOptionRestarted);

assertEquals(infrastructureOption, infrastructureOptionRestarted);
Thread.sleep(2000);

}

@Test
public void runRestartWorkFlowComplex() throws ApiException {
public void runRestartWorkFlowComplex() throws ApiException, InterruptedException {
log.info("******** Running The Complex workFlow ********");
TestComponents components = new WorkFlowTestBuilder().withDefaultProject().withWorkFlowDefinition(WORKFLOW_NAME)
.build();
Expand Down Expand Up @@ -218,6 +220,7 @@ public void runRestartWorkFlowComplex() throws ApiException {
WorkFlowStatusResponseDTO restartedWorkflowStatus = workflowApi
.getStatus(restartedWorkFlowStatusResponseDTO.getWorkFlowExecutionId());
assertEquals(workFlowResponseDTO.getWorkFlowExecutionId(), restartedWorkflowStatus.getOriginalExecutionId());
Thread.sleep(2000);
}

@Test
Expand Down Expand Up @@ -355,6 +358,7 @@ public void runRestartWorkFlowComplexMultipleTimes() throws ApiException, Interr
assertEquals(workFlowResponseDTO.getWorkFlowExecutionId(),
restartedWorkflowStatus.getOriginalExecutionId());
}
Thread.sleep(2000);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public static WorkFlowStatusResponseDTO waitWorkflowStatusAsync(WorkflowApi work
}
if (status.getStatus() != expectedStatus) {
throw new WrongStatusException(
"Workflow status is not %s, it is %s ".formatted(expectedStatus, status.getStatus()));
"Workflow is finished and its status is %s while was expecting it to be %s"
.formatted(status.getStatus(), expectedStatus));
}
return status;
};
Expand Down

0 comments on commit 02c5d4f

Please sign in to comment.