From d3775e110f092a520fc1b0b837387ea25c9ea3c7 Mon Sep 17 00:00:00 2001 From: "jose.vazquez" Date: Thu, 8 Feb 2024 09:54:13 +0100 Subject: [PATCH] Force reply with AtlasDeploymentReady type Signed-off-by: jose.vazquez --- .../atlasdeployment/atlasdeployment_controller.go | 4 ++-- .../atlasdeployment/atlasdeployment_controller_test.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/controller/atlasdeployment/atlasdeployment_controller.go b/pkg/controller/atlasdeployment/atlasdeployment_controller.go index 5e1bdff60b..fd4526d214 100644 --- a/pkg/controller/atlasdeployment/atlasdeployment_controller.go +++ b/pkg/controller/atlasdeployment/atlasdeployment_controller.go @@ -234,7 +234,7 @@ func (r *AtlasDeploymentReconciler) checkDeploymentIsManaged( if err != nil { result := workflow.Terminate(workflow.Internal, fmt.Sprintf("unable to resolve ownership for deletion protection: %s", err)) - workflowCtx.SetConditionFromResult(status.DatabaseUserReadyType, result) + workflowCtx.SetConditionFromResult(status.DeploymentReadyType, result) log.Error(result.GetMessage()) return result @@ -245,7 +245,7 @@ func (r *AtlasDeploymentReconciler) checkDeploymentIsManaged( workflow.AtlasDeletionProtection, "unable to reconcile Deployment due to deletion protection being enabled. see https://dochub.mongodb.org/core/ako-deletion-protection for further information", ) - workflowCtx.SetConditionFromResult(status.DatabaseUserReadyType, result) + workflowCtx.SetConditionFromResult(status.DeploymentReadyType, result) log.Error(result.GetMessage()) return result diff --git a/pkg/controller/atlasdeployment/atlasdeployment_controller_test.go b/pkg/controller/atlasdeployment/atlasdeployment_controller_test.go index cc56d7db1a..4ff9a02d68 100644 --- a/pkg/controller/atlasdeployment/atlasdeployment_controller_test.go +++ b/pkg/controller/atlasdeployment/atlasdeployment_controller_test.go @@ -143,6 +143,10 @@ func TestProtectedAdvancedDeploymentManagedInAtlas(t *testing.T) { if tc.expectedErr == "" { assert.True(t, result.IsOk()) } else { + assert.NotNil(t, te.workflowCtx.LastCondition()) + if te.workflowCtx.LastCondition() != nil { + assert.Equal(t, status.DeploymentReadyType, te.workflowCtx.LastCondition().Type) + } assert.Regexp(t, regexp.MustCompile(tc.expectedErr), result.GetMessage()) } }) @@ -189,6 +193,10 @@ func TestProtectedServerlessManagedInAtlas(t *testing.T) { if tc.expectedErr == "" { assert.True(t, result.IsOk()) } else { + assert.NotNil(t, te.workflowCtx.LastCondition()) + if te.workflowCtx.LastCondition() != nil { + assert.Equal(t, status.DeploymentReadyType, te.workflowCtx.LastCondition().Type) + } assert.Regexp(t, regexp.MustCompile(tc.expectedErr), result.GetMessage()) } })