From c40e257df8dc9a94494d27bb25b2102d3defb777 Mon Sep 17 00:00:00 2001 From: Gloria Ciavarrini Date: Fri, 4 Aug 2023 17:26:34 +0200 Subject: [PATCH] Fix unit test for PlanStatusWorkFlowChecker Signed-off-by: Gloria Ciavarrini --- .../checker/PlanStatusWorkFlowCheckerTest.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/prebuilt-tasks/src/test/java/com/redhat/parodos/tasks/vmmigration/checker/PlanStatusWorkFlowCheckerTest.java b/prebuilt-tasks/src/test/java/com/redhat/parodos/tasks/vmmigration/checker/PlanStatusWorkFlowCheckerTest.java index fc34359ce..f90572aa6 100644 --- a/prebuilt-tasks/src/test/java/com/redhat/parodos/tasks/vmmigration/checker/PlanStatusWorkFlowCheckerTest.java +++ b/prebuilt-tasks/src/test/java/com/redhat/parodos/tasks/vmmigration/checker/PlanStatusWorkFlowCheckerTest.java @@ -1,5 +1,6 @@ package com.redhat.parodos.tasks.vmmigration.checker; +import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -19,7 +20,6 @@ import io.fabric8.openshift.client.server.mock.OpenShiftServer; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static java.net.HttpURLConnection.HTTP_OK; @@ -127,8 +127,6 @@ public void executeFail() { } @Test - @Disabled - // FIXME public void executeRejected() { // given @@ -154,8 +152,6 @@ public void executeRejected() { } @Test - @Disabled - // FIXME public void executeTimeoutRejected() { // given @@ -163,14 +159,17 @@ public void executeTimeoutRejected() { Constants.NETWORK_NAME_PARAMETER_NAME, Constants.NAMESPACE_NAME_PARAMETER_NAME, Constants.DESTINATION_PROVIDER_TYPE_PARAMETER_NAME, Constants.SOURCE_PROVIDER_TYPE_PARAMETER_NAME); plan.getMetadata().setName(Constants.PLAN_NAME_PARAMETER_NAME); + plan.getMetadata().setCreationTimestamp(Instant.now().plusSeconds(300).toString()); PlanStatus status = new PlanStatus(); Conditions condition = new Conditions(); condition.setType("Ready"); - condition.setStatus("True"); + condition.setStatus("False"); status.setConditions(List.of(condition)); plan.setStatus(status); - mockServer.expect().post().withPath("/apis/forklift.konveyor.io/v1beta1/namespaces/%s/plans/" - .formatted(Constants.NAMESPACE_NAME_PARAMETER_NAME)).andReturn(HTTP_OK, plan).always(); + mockServer.expect().get() + .withPath("/apis/forklift.konveyor.io/v1beta1/namespaces/%s/plans/%s" + .formatted(Constants.NAMESPACE_NAME_PARAMETER_NAME, Constants.PLAN_NAME_PARAMETER_NAME)) + .andReturn(HTTP_OK, plan).always(); // when planStatusWorkFlowChecker.preExecute(ctx);