From 1d1b42d4e65fadca7da07e27772acdac50bf5b50 Mon Sep 17 00:00:00 2001 From: Apoorv Mahajan Date: Thu, 21 Oct 2021 03:24:24 +0530 Subject: [PATCH] tests(orca/clouddriver): refactor tests to remove some test code duplications and make them more descriptive --- .../tasks/job/WaitOnJobCompletionTest.java | 260 +++----- .../failed-runjob-status.json | 0 ...njob-stage-context-with-property-file.json | 0 ...-stage-context-without-property-file.json} | 0 .../successful-runjob-status.json | 0 .../tasks/job/runjob-context-success.json | 266 --------- .../tasks/job/successful-run-job-state.json | 564 ------------------ 7 files changed, 85 insertions(+), 1005 deletions(-) rename orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/{ => kubernetes}/failed-runjob-status.json (100%) rename orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/{ => kubernetes}/runjob-stage-context-with-property-file.json (100%) rename orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/{runjob-stage-context.json => kubernetes/runjob-stage-context-without-property-file.json} (100%) rename orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/{ => kubernetes}/successful-runjob-status.json (100%) delete mode 100644 orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-context-success.json delete mode 100644 orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/successful-run-job-state.json diff --git a/orca-clouddriver/src/test/java/com/netflix/spinnaker/orca/clouddriver/tasks/job/WaitOnJobCompletionTest.java b/orca-clouddriver/src/test/java/com/netflix/spinnaker/orca/clouddriver/tasks/job/WaitOnJobCompletionTest.java index e9c58ed4a9..196ed9fc2c 100644 --- a/orca-clouddriver/src/test/java/com/netflix/spinnaker/orca/clouddriver/tasks/job/WaitOnJobCompletionTest.java +++ b/orca-clouddriver/src/test/java/com/netflix/spinnaker/orca/clouddriver/tasks/job/WaitOnJobCompletionTest.java @@ -51,11 +51,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import okhttp3.MediaType; -import okhttp3.Protocol; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; import org.apache.commons.io.IOUtils; import org.assertj.core.api.AssertionsForClassTypes; import org.junit.jupiter.api.BeforeEach; @@ -63,14 +58,12 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import retrofit.client.Response; import retrofit.mime.TypedByteArray; -import retrofit.mime.TypedInput; public final class WaitOnJobCompletionTest { private ObjectMapper objectMapper; - private RetrySupport retrySupport; private KatoRestService mockKatoRestService; - private JobUtils mockJobUtils; private ExecutionRepository mockExecutionRepository; private TaskConfigurationProperties configProperties; private Front50Service mockFront50Service; @@ -79,13 +72,13 @@ public final class WaitOnJobCompletionTest { @BeforeEach public void setup() { objectMapper = new ObjectMapper(); - retrySupport = new RetrySupport(); + RetrySupport retrySupport = new RetrySupport(); configProperties = new TaskConfigurationProperties(); configProperties .getWaitOnJobCompletionTask() .setExcludeKeysFromOutputs(Set.of("completionDetails")); mockKatoRestService = mock(KatoRestService.class); - mockJobUtils = mock(JobUtils.class); + JobUtils mockJobUtils = mock(JobUtils.class); mockExecutionRepository = mock(ExecutionRepository.class); mockFront50Service = mock(Front50Service.class); @@ -116,8 +109,8 @@ void jobTimeoutSpecifiedByRunJobTask() { @Test void taskSearchJobByApplicationUsingContextApplication() { - retrofit.client.Response mockResponse = - new retrofit.client.Response( + Response mockResponse = + new Response( "test-url", 200, "test-reason", @@ -142,8 +135,8 @@ void taskSearchJobByApplicationUsingContextApplication() { @Test void taskSearchJobByApplicationUsingContextMoniker() { - retrofit.client.Response mockResponse = - new retrofit.client.Response( + Response mockResponse = + new Response( "test-url", 200, "test-reason", @@ -167,8 +160,8 @@ void taskSearchJobByApplicationUsingContextMoniker() { @Test void taskSearchJobByApplicationUsingParsedName() { - retrofit.client.Response mockResponse = - new retrofit.client.Response( + Response mockResponse = + new Response( "test-url", 200, "test-reason", @@ -191,8 +184,8 @@ void taskSearchJobByApplicationUsingParsedName() { @Test void taskSearchJobByApplicationUsingExecutionApp() { - retrofit.client.Response mockResponse = - new retrofit.client.Response( + Response mockResponse = + new Response( "test-url", 200, "test-reason", @@ -213,24 +206,16 @@ void taskSearchJobByApplicationUsingExecutionApp() { } @DisplayName( - "parameterized test for checking how property file contents are set in the stage context for a successful runjob") + "parameterized test for checking how property file contents are set in the stage context for a successful k8s runjob") @ParameterizedTest(name = "{index} ==> isPropertyFileContentsEmpty = {0}") @ValueSource(booleans = {true, false}) - void testPropertyFileContentsHandlingForASuccessfulRunJob(boolean isPropertyFileContentsEmpty) + void testPropertyFileContentsHandlingForASuccessfulK8sRunJob(boolean isPropertyFileContentsEmpty) throws IOException { // setup - InputStream jobStatusInputStream = - getResourceAsStream("clouddriver/tasks/job/successful-runjob-status.json"); - - retrofit.client.Response mockResponse = - new retrofit.client.Response( - "test-url", - 200, - "test-reason", - Collections.emptyList(), - new TypedByteArray("application/json", IOUtils.toByteArray(jobStatusInputStream))); - - when(mockKatoRestService.collectJob(any(), any(), any(), any())).thenReturn(mockResponse); + when(mockKatoRestService.collectJob(any(), any(), any(), any())) + .thenReturn( + createJobStatusFromResource( + "clouddriver/tasks/job/kubernetes/successful-runjob-status.json")); Map propertyFileContents = new HashMap<>(); if (!isPropertyFileContentsEmpty) { @@ -240,12 +225,9 @@ void testPropertyFileContentsHandlingForASuccessfulRunJob(boolean isPropertyFile eq("test-app"), eq("test-account"), eq("test"), eq("job testrep"), eq("testrep"))) .thenReturn(propertyFileContents); - Map stageContext = - getResource( - objectMapper, - "clouddriver/tasks/job/runjob-stage-context-with-property-file.json", - Map.class); - StageExecutionImpl myStage = createStageWithContext(stageContext); + StageExecution myStage = + createStageFromResource( + "clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json"); // when ConfigurationException thrown = null; @@ -284,35 +266,24 @@ void testPropertyFileContentsHandlingForASuccessfulRunJob(boolean isPropertyFile } @Test - void testPropertyFileContentsErrorHandlingForASuccessfulRunJob() throws IOException { - // setup - InputStream jobStatusInputStream = - getResourceAsStream("clouddriver/tasks/job/successful-runjob-status.json"); - - retrofit.client.Response mockResponse = - new retrofit.client.Response( - "test-url", - 200, - "test-reason", - Collections.emptyList(), - new TypedByteArray("application/json", IOUtils.toByteArray(jobStatusInputStream))); - - when(mockKatoRestService.collectJob(any(), any(), any(), any())).thenReturn(mockResponse); + void testPropertyFileContentsErrorHandlingForASuccessfulK8sRunJob() throws IOException { + when(mockKatoRestService.collectJob(any(), any(), any(), any())) + .thenReturn( + createJobStatusFromResource( + "clouddriver/tasks/job/kubernetes/successful-runjob-status.json")); when(mockKatoRestService.getFileContents( eq("test-app"), eq("test-account"), eq("test"), eq("job testrep"), eq("testrep"))) .thenThrow(new RuntimeException("some exception")); - Map stageContext = - getResource( - objectMapper, - "clouddriver/tasks/job/runjob-stage-context-with-property-file.json", - Map.class); - StageExecutionImpl myStage = createStageWithContext(stageContext); - // when ConfigurationException thrown = - assertThrows(ConfigurationException.class, () -> task.execute(myStage)); + assertThrows( + ConfigurationException.class, + () -> + task.execute( + createStageFromResource( + "clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json"))); // then verify(mockKatoRestService, times(1)) @@ -337,37 +308,24 @@ void testPropertyFileContentsErrorHandlingForASuccessfulRunJob() throws IOExcept } @DisplayName( - "parameterized test for checking if an exception is thrown when a run job fails, with or without a propertyFile") + "parameterized test for checking if an exception is thrown when a k8s run job fails, with or without a propertyFile") @ParameterizedTest(name = "{index} ==> includePropertyFile = {0}") @ValueSource(booleans = {true, false}) - void testRunJobFailuresErrorHandling(boolean includePropertyFile) throws IOException { + void testK8sRunJobFailuresErrorHandling(boolean includePropertyFile) throws IOException { // setup - InputStream jobStatusInputStream = - getResourceAsStream("clouddriver/tasks/job/failed-runjob-status.json"); + when(mockKatoRestService.collectJob(any(), any(), any(), any())) + .thenReturn( + createJobStatusFromResource( + "clouddriver/tasks/job/kubernetes/failed-runjob-status.json")); - retrofit.client.Response mockResponse = - new retrofit.client.Response( - "test-url", - 200, - "test-reason", - Collections.emptyList(), - new TypedByteArray("application/json", IOUtils.toByteArray(jobStatusInputStream))); - - when(mockKatoRestService.collectJob(any(), any(), any(), any())).thenReturn(mockResponse); - - Map stageContext = new HashMap<>(); + String stageContextResource = + "clouddriver/tasks/job/kubernetes/runjob-stage-context-without-property-file.json"; if (includePropertyFile) { - stageContext = - getResource( - objectMapper, - "clouddriver/tasks/job/runjob-stage-context-with-property-file.json", - Map.class); - } else { - stageContext = - getResource(objectMapper, "clouddriver/tasks/job/runjob-stage-context.json", Map.class); + stageContextResource = + "clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json"; } - StageExecutionImpl myStage = createStageWithContext(stageContext); + StageExecution myStage = createStageFromResource(stageContextResource); // when JobFailedException thrown = assertThrows(JobFailedException.class, () -> task.execute(myStage)); @@ -407,21 +365,13 @@ void testRunJobFailuresErrorHandling(boolean includePropertyFile) throws IOExcep "parameterized test for checking how property file contents are set in the stage context on a runjob failure") @ParameterizedTest(name = "{index} ==> isPropertyFileContentsEmpty = {0}") @ValueSource(booleans = {true, false}) - void testPropertyFileContentsHandlingForRunJobFailures(boolean isPropertyFileContentsEmpty) + void testPropertyFileContentsHandlingForK8sRunJobFailures(boolean isPropertyFileContentsEmpty) throws IOException { // setup - InputStream jobStatusInputStream = - getResourceAsStream("clouddriver/tasks/job/failed-runjob-status.json"); - - retrofit.client.Response mockResponse = - new retrofit.client.Response( - "test-url", - 200, - "test-reason", - Collections.emptyList(), - new TypedByteArray("application/json", IOUtils.toByteArray(jobStatusInputStream))); - - when(mockKatoRestService.collectJob(any(), any(), any(), any())).thenReturn(mockResponse); + when(mockKatoRestService.collectJob(any(), any(), any(), any())) + .thenReturn( + createJobStatusFromResource( + "clouddriver/tasks/job/kubernetes/failed-runjob-status.json")); Map propertyFileContents = new HashMap<>(); if (!isPropertyFileContentsEmpty) { @@ -432,12 +382,9 @@ void testPropertyFileContentsHandlingForRunJobFailures(boolean isPropertyFileCon eq("test-app"), eq("test-account"), eq("test"), eq("job testrep"), eq("testrep"))) .thenReturn(propertyFileContents); - Map stageContext = - getResource( - objectMapper, - "clouddriver/tasks/job/runjob-stage-context-with-property-file.json", - Map.class); - StageExecutionImpl myStage = createStageWithContext(stageContext); + StageExecution myStage = + createStageFromResource( + "clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json"); // when JobFailedException thrown = assertThrows(JobFailedException.class, () -> task.execute(myStage)); @@ -457,8 +404,7 @@ void testPropertyFileContentsHandlingForRunJobFailures(boolean isPropertyFileCon verify(mockExecutionRepository, times(1)).storeStage(myStage); // validate that depending on the response obtained from the getFileContents() call, we either - // set - // propertyFileContents in the stage context or not + // set propertyFileContents in the stage context or not if (isPropertyFileContentsEmpty) { assertThat(myStage.getContext().containsKey("propertyFileContents")).isFalse(); } else { @@ -480,31 +426,20 @@ void testPropertyFileContentsHandlingForRunJobFailures(boolean isPropertyFileCon } @Test - void testPropertyFileContentsErrorHandlingForRunJobFailures() throws IOException { + void testPropertyFileContentsErrorHandlingForK8sRunJobFailures() throws IOException { // setup - InputStream jobStatusInputStream = - getResourceAsStream("clouddriver/tasks/job/failed-runjob-status.json"); - - retrofit.client.Response mockResponse = - new retrofit.client.Response( - "test-url", - 200, - "test-reason", - Collections.emptyList(), - new TypedByteArray("application/json", IOUtils.toByteArray(jobStatusInputStream))); - - when(mockKatoRestService.collectJob(any(), any(), any(), any())).thenReturn(mockResponse); + when(mockKatoRestService.collectJob(any(), any(), any(), any())) + .thenReturn( + createJobStatusFromResource( + "clouddriver/tasks/job/kubernetes/failed-runjob-status.json")); when(mockKatoRestService.getFileContents( eq("test-app"), eq("test-account"), eq("test"), eq("job testrep"), eq("testrep"))) .thenThrow(new RuntimeException("some exception")); - Map stageContext = - getResource( - objectMapper, - "clouddriver/tasks/job/runjob-stage-context-with-property-file.json", - Map.class); - StageExecutionImpl myStage = createStageWithContext(stageContext); + StageExecution myStage = + createStageFromResource( + "clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json"); // when JobFailedException thrown = assertThrows(JobFailedException.class, () -> task.execute(myStage)); @@ -555,6 +490,22 @@ private StageExecutionImpl createStageWithContextWithoutExecutionApplication( new PipelineExecutionImpl(ExecutionType.PIPELINE, null), "test", new HashMap<>(context)); } + private StageExecution createStageFromResource(String resourceName) { + Map context = getResource(objectMapper, resourceName, Map.class); + return createStageWithContext(context); + } + + private Response createJobStatusFromResource(String resourceName) throws IOException { + InputStream jobStatusInputStream = getResourceAsStream(resourceName); + + return new Response( + "test-url", + 200, + "test-reason", + Collections.emptyList(), + new TypedByteArray("application/json", IOUtils.toByteArray(jobStatusInputStream))); + } + @DisplayName( "parameterized test to see how keys in the outputs object are filtered based on the inputs") @ParameterizedTest(name = "{index} ==> keys to be excluded from outputs = {0}") @@ -570,61 +521,20 @@ void testOutputFilter(String keysToFilter) throws IOException { .getWaitOnJobCompletionTask() .setExcludeKeysFromOutputs(expectedKeysToBeExcludedFromOutput); - InputStream inputStream = - getResourceAsStream("clouddriver/tasks/job/successful-run-job-state.json"); - - // mocked response from clouddriver - Response response = - new Response.Builder() - .code(200) - .message("some message") - .request(new Request.Builder().url("http://url").build()) - .protocol(Protocol.HTTP_1_0) - .body( - ResponseBody.create( - MediaType.parse("application/json"), IOUtils.toByteArray(inputStream))) - .addHeader("content-type", "application/json") - .build(); - - retrofit.client.Response retrofitResponse = - new retrofit.client.Response( - "http://url", - 200, - "", - Collections.emptyList(), - new TypedInput() { - @Override - public String mimeType() { - okhttp3.MediaType mediaType = response.body().contentType(); - return mediaType == null ? null : mediaType.toString(); - } - - @Override - public long length() { - return response.body().contentLength(); - } - - @Override - public InputStream in() { - return response.body().byteStream(); - } - }); - - when(mockKatoRestService.collectJob("testrep", "test-account", "test", "job testrep")) - .thenReturn(retrofitResponse); + // when + when(mockKatoRestService.collectJob("test-app", "test-account", "test", "job testrep")) + .thenReturn( + createJobStatusFromResource( + "clouddriver/tasks/job/kubernetes/successful-runjob-status.json")); when(mockKatoRestService.getFileContents( - "testrep", "test-account", "test", "job testrep", "testrep")) + "test-app", "test-account", "test", "job testrep", "testrep")) .thenReturn(Map.of("some-key", "some-value")); - Map context = - getResource(objectMapper, "clouddriver/tasks/job/runjob-context-success.json", Map.class); - StageExecution stageExecution = - new StageExecutionImpl( - new PipelineExecutionImpl(ExecutionType.PIPELINE, "testrep"), "test", context); - - // when - TaskResult result = task.execute(stageExecution); + TaskResult result = + task.execute( + createStageFromResource( + "clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json")); // then assertThat(result.getOutputs()).isNotEmpty(); diff --git a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/failed-runjob-status.json b/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/failed-runjob-status.json similarity index 100% rename from orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/failed-runjob-status.json rename to orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/failed-runjob-status.json diff --git a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-stage-context-with-property-file.json b/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json similarity index 100% rename from orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-stage-context-with-property-file.json rename to orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/runjob-stage-context-with-property-file.json diff --git a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-stage-context.json b/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/runjob-stage-context-without-property-file.json similarity index 100% rename from orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-stage-context.json rename to orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/runjob-stage-context-without-property-file.json diff --git a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/successful-runjob-status.json b/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/successful-runjob-status.json similarity index 100% rename from orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/successful-runjob-status.json rename to orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/kubernetes/successful-runjob-status.json diff --git a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-context-success.json b/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-context-success.json deleted file mode 100644 index 625ee0f898..0000000000 --- a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/runjob-context-success.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "notification.type": "runjob", - "deploy.account.name": "test-account", - "outputs.createdArtifacts": [ - { - "customKind": false, - "reference": "testrep", - "metadata": { - "account": "test-account" - }, - "name": "testrep", - "location": "test", - "type": "kubernetes/job", - "version": "" - } - ], - "propertyFile": "testrep", - "consumeArtifactSource": "propertyFile", - "stageEnabled": {}, - "source": "text", - "dev": true, - "cloudProvider": "kubernetes", - "kato.result.expected": false, - "alias": "runJob", - "deploy.server.groups": {}, - "kato.last.task.id": { - "id": "123" - }, - "artifacts": [ - { - "customKind": false, - "reference": "testrep", - "metadata": { - "account": "test-account" - }, - "name": "testrep", - "location": "test", - "type": "kubernetes/job", - "version": "" - } - ], - "manifest": { - "metadata": { - "name": " testrep", - "namespace": "test", - "labels": { - "p_environment_type": "dev" - } - }, - "apiVersion": "batch/v1", - "kind": "Job", - "spec": { - "template": { - "spec": { - "dnsPolicy": "ClusterFirst", - "terminationGracePeriodSeconds": 30, - "automountServiceAccountToken": true, - "serviceAccountName": "test", - "volumes": [ - { - "configMap": { - "name": "configmap" - }, - "name": "configmap-volume" - }, - { - "configMap": { - "name": "configmap-1" - }, - "name": "configs-volume-1" - }, - { - "name": "creds", - "secret": { - "secretName": "secret" - } - }, - { - "emptyDir": {}, - "name": "secrets-volume" - } - ], - "containers": [ - { - "image": "main-app-image:1", - "terminationMessagePolicy": "FallbackToLogsOnError", - "name": "testrepl1", - "env": [ - { - "name": "LEVEL", - "value": "service" - } - ], - "volumeMounts": [ - { - "mountPath": "/usr/test/configs", - "name": "configmap-volume" - } - ] - } - ], - "securityContext": { - "fsGroup": 100 - }, - "restartPolicy": "Never", - "initContainers": [] - } - }, - "backoffLimit": 0, - "activeDeadlineSeconds": 900, - "ttlSecondsAfterFinished": 600 - } - }, - "kato.task.terminalRetryCount": 0, - "isNew": true, - "kato.task.firstNotFoundRetry": -1, - "failOnFailedExpressions": true, - "outputs.manifestNamesByNamespace": { - "test": [ - "job testrep" - ] - }, - "application": "testrep", - "outputs.boundArtifacts": [], - "credentails": "test-account", - "kato.tasks": [ - { - "outputs": [], - "resultObjects": [ - { - "createdArtifacts": [ - { - "customKind": false, - "reference": "testrep", - "metadata": { - "account": "test-account" - }, - "name": "testrep", - "location": "test", - "type": "kubernetes/job", - "version": "" - } - ], - "boundArtifacts": [] - } - ], - "id": "123", - "history": [ - { - "phase": "ORCHESTRATION", - "status": "Initializing Orchestration Task" - }, - { - "phase": "ORCHESTRATION", - "status": "Processing op: KubernetesRunJobOperation" - }, - { - "phase": "RUN_KUBERNETES_JOB", - "status": "Running Kubernetes job..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Beginning deployment of manifests in account test-account ..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Swapping out artifacts in job testrep from context..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Finding deployer for job..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Checking if all requested artifacts were bound..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Sorting manifests by priority..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Deploy order is: job testrep" - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Finding deployer for job..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Annotating manifest job testrep with artifact, relationships & moniker..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Swapping out artifacts in job testrep from other deployments..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Submitting manifest job testrep to kubernetes master..." - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Deploy manifest task completed successfully for manifest job testrep in account test-account" - }, - { - "phase": "DEPLOY_KUBERNETES_MANIFEST", - "status": "Deploy manifest task completed successfully for all manifests in account test-account" - }, - { - "phase": "ORCHESTRATION", - "status": "Orchestration completed." - }, - { - "phase": "ORCHESTRATION", - "status": "Orchestration completed." - } - ], - "status": { - "retryable": false, - "completed": true, - "failed": false - } - } - ], - "deploy.jobs": { - "test": [ - "job testrep" - ] - }, - "outputs.manifests": [ - { - "metadata": { - "uid": "eaf5237d-774e-49f6-b3a1-ac90a7e47756", - "resourceVersion": "172459430", - "creationTimestamp": "2021-08-11T01:40:00Z", - "name": "testrep", - "namespace": "test" - }, - "apiVersion": "batch/v1", - "kind": "Job", - "spec": { - "backoffLimit": 0, - "parallelism": 1, - "completions": 1, - "selector": { - "matchLabels": { - "controller-uid": "eaf" - } - }, - "activeDeadlineSeconds": 900 - }, - "status": {} - } - ], - "kato.task.notFoundRetryCount": 0, - "account": "test-account", - "kato.task.lastStatus": "SUCCEEDED", - "propertyFileContents": { - "dev": true, - "some_other_output": {} - }, - "output_from_runjob": { - "target_level": "service" - } - } -} diff --git a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/successful-run-job-state.json b/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/successful-run-job-state.json deleted file mode 100644 index 338a9ea57a..0000000000 --- a/orca-clouddriver/src/test/resources/com/netflix/spinnaker/orca/clouddriver/tasks/job/successful-run-job-state.json +++ /dev/null @@ -1,564 +0,0 @@ -{ -"provider": "kubernetes", -"completionDetails": { -"summary": "", -"reason": "", -"exitCode": "", -"message": "", -"signal": "" -}, -"jobState": "Succeeded", -"name": "testrep", -"createdTime": 1628646000000, -"location": "test", -"pods": [ -{ -"containerExecutionDetails": [], -"name": "testrep-lnk4x", -"status": { -"phase": "Succeeded", -"podIP": "1.1.1.1", -"containerStatuses": [ -{ -"image": "sha256:123", -"imageID": "docker-pullable://some-repo:1", -"restartCount": 0, -"ready": false, -"name": "testrepv2-l1", -"started": false, -"state": { -"terminated": { -"reason": "Completed", -"exitCode": 0, -"startedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 24, -"millisOfDay": 6024000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6024, -"millis": 1628646024000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"containerID": "docker://456", -"finishedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 27, -"millisOfDay": 6027000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6027, -"millis": 1628646027000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -} -} -}, -"containerID": "docker://456", -"lastState": {} -} -], -"hostIP": "1.1.1.1", -"startTime": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 1, -"millisOfDay": 6001000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6001, -"millis": 1628646001000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"qosClass": "Burstable", -"conditions": [ -{ -"reason": "PodCompleted", -"lastTransitionTime": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 23, -"millisOfDay": 6023000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6023, -"millis": 1628646023000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"type": "Initialized", -"status": "True" -}, -{ -"reason": "PodCompleted", -"lastTransitionTime": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 27, -"millisOfDay": 6027000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6027, -"millis": 1628646027000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"type": "Ready", -"status": "False" -}, -{ -"reason": "PodCompleted", -"lastTransitionTime": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 27, -"millisOfDay": 6027000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6027, -"millis": 1628646027000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"type": "ContainersReady", -"status": "False" -}, -{ -"lastTransitionTime": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 1, -"millisOfDay": 6001000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6001, -"millis": 1628646001000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"type": "PodScheduled", -"status": "True" -} -], -"initContainerStatuses": [ -{ -"image": "some-init-container-image:1", -"imageID": "docker-pullable://some-init-container-repo/some-init-container-image:1", -"restartCount": 0, -"ready": true, -"name": "init", -"state": { -"terminated": { -"reason": "Completed", -"exitCode": 0, -"startedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 2, -"millisOfDay": 6002000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6002, -"millis": 1628646002000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"containerID": "docker://789", -"finishedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 19, -"millisOfDay": 6019000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6019, -"millis": 1628646019000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -} -} -}, -"containerID": "docker://789", -"lastState": {} -}, -{ -"image": "init-container-2:1", -"imageID": "docker-pullable://some-repo/init-container-2:1", -"restartCount": 0, -"ready": true, -"name": "init2", -"state": { -"terminated": { -"reason": "Completed", -"exitCode": 0, -"startedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 20, -"millisOfDay": 6020000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6020, -"millis": 1628646020000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"containerID": "docker://012", -"finishedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 21, -"millisOfDay": 6021000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6021, -"millis": 1628646021000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -} -} -}, -"containerID": "docker://012", -"lastState": {} -}, -{ -"image": "init-container-3:1", -"imageID": "docker-pullable://some-repo/init-container-3:1", -"restartCount": 0, -"ready": true, -"name": "init-3", -"state": { -"terminated": { -"reason": "Completed", -"exitCode": 0, -"startedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 21, -"millisOfDay": 6021000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6021, -"millis": 1628646021000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -}, -"containerID": "docker://345", -"finishedAt": { -"dayOfYear": 223, -"equalNow": false, -"year": 2021, -"weekyear": 2021, -"chronology": { -"zone": { -"fixed": true, -"id": "Etc/GMT" -} -}, -"weekOfWeekyear": 32, -"secondOfMinute": 23, -"millisOfDay": 6023000, -"monthOfYear": 8, -"beforeNow": true, -"dayOfWeek": 3, -"minuteOfDay": 100, -"dayOfMonth": 11, -"era": 1, -"zone": { -"fixed": true, -"id": "Etc/GMT" -}, -"yearOfCentury": 21, -"centuryOfEra": 20, -"hourOfDay": 1, -"secondOfDay": 6023, -"millis": 1628646023000, -"yearOfEra": 2021, -"minuteOfHour": 40, -"afterNow": false, -"millisOfSecond": 0 -} -} -}, -"containerID": "docker://345", -"lastState": {} -} -], -"podIPs": [ -{ -"ip": "10.33.167.185" -} -] -} -} -], -"account": "test-account" -}