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

Commit

Permalink
fix: Move2KubePlanTest refactor to make it faster
Browse files Browse the repository at this point in the history
Signed-off-by: Eloy Coto <[email protected]>
  • Loading branch information
eloycoto authored and openshift-merge-robot committed Jun 15, 2023
1 parent fe03390 commit 9bf80b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import dev.parodos.move2kube.api.PlanApi;
import dev.parodos.move2kube.api.ProjectInputsApi;
import dev.parodos.move2kube.client.model.GetPlan200Response;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import static java.lang.Thread.sleep;
Expand All @@ -20,6 +21,9 @@ public class Move2KubePlan extends Move2KubeBase {

private PlanApi planApi;

@Setter
private long sleepTime = 1000;

private ProjectInputsApi projectInputsApi;

public Move2KubePlan(String server) {
Expand Down Expand Up @@ -51,7 +55,7 @@ public WorkReport execute(WorkContext workContext) {
GetPlan200Response plan = planApi.getPlan(workspaceID, projectID);
if (plan == null) {
try {
sleep(i * 1000);
sleep(i * this.sleepTime);
}
catch (Exception e) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void setup() {
PlanApi planApi = mock(PlanApi.class);

task = new Move2KubePlan("http://localhost:8080", planApi, projectInputsApi);
task.setSleepTime(1);
}

@Test
Expand Down

0 comments on commit 9bf80b7

Please sign in to comment.