diff --git a/api/deployments/deployment_controller_test.go b/api/deployments/deployment_controller_test.go index 42cc1f1c..d040980e 100644 --- a/api/deployments/deployment_controller_test.go +++ b/api/deployments/deployment_controller_test.go @@ -336,13 +336,18 @@ func TestGetDeployment_TwoDeploymentsFirstDeployment_ReturnsDeploymentWithCompon anyDeployment2Name := "ghijkl" appDeployment1Created, _ := radixutils.ParseTimestamp("2018-11-12T12:00:00Z") appDeployment2Created, _ := radixutils.ParseTimestamp("2018-11-14T12:00:00Z") + jobName1, jobName2 := "rj1", "rj2" + commitID1 := "commit1" - _, err := commonTestUtils.ApplyDeployment(builders. + _, err := commonTestUtils.ApplyJob(builders.ARadixBuildDeployJob().WithAppName(anyAppName).WithJobName(jobName1).WithCommitID(commitID1)) + require.NoError(t, err) + _, err = commonTestUtils.ApplyDeployment(builders. NewDeploymentBuilder(). WithRadixApplication( builders.ARadixApplication(). WithAppName(anyAppName)). WithAppName(anyAppName). + WithLabel(kube.RadixJobNameLabel, jobName1). WithDeploymentName(anyDeployment1Name). WithCreated(appDeployment1Created). WithCondition(v1.DeploymentInactive). @@ -372,6 +377,7 @@ func TestGetDeployment_TwoDeploymentsFirstDeployment_ReturnsDeploymentWithCompon builders.ARadixApplication(). WithAppName(anyAppName)). WithAppName(anyAppName). + WithLabel(kube.RadixJobNameLabel, jobName2). WithDeploymentName(anyDeployment2Name). WithCreated(appDeployment2Created). WithCondition(v1.DeploymentActive). diff --git a/api/deployments/deployment_handler.go b/api/deployments/deployment_handler.go index 5deecda8..30028d82 100644 --- a/api/deployments/deployment_handler.go +++ b/api/deployments/deployment_handler.go @@ -202,7 +202,7 @@ func (deploy *deployHandler) getRadixDeploymentRadixJob(ctx context.Context, app jobName := rd.GetLabels()[kube.RadixJobNameLabel] radixJob, err := kubequery.GetRadixJob(ctx, deploy.accounts.UserAccount.RadixClient, appName, jobName) if err != nil { - if !errors.IsNotFound(err) { + if errors.IsNotFound(err) { return nil, nil } return nil, err