Skip to content

Commit 03001b9

Browse files
authored
Force reply with AtlasDeploymentReady type (#1366)
Signed-off-by: jose.vazquez <[email protected]>
1 parent 1229951 commit 03001b9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/controller/atlasdeployment/atlasdeployment_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (r *AtlasDeploymentReconciler) checkDeploymentIsManaged(
234234

235235
if err != nil {
236236
result := workflow.Terminate(workflow.Internal, fmt.Sprintf("unable to resolve ownership for deletion protection: %s", err))
237-
workflowCtx.SetConditionFromResult(status.DatabaseUserReadyType, result)
237+
workflowCtx.SetConditionFromResult(status.DeploymentReadyType, result)
238238
log.Error(result.GetMessage())
239239

240240
return result
@@ -245,7 +245,7 @@ func (r *AtlasDeploymentReconciler) checkDeploymentIsManaged(
245245
workflow.AtlasDeletionProtection,
246246
"unable to reconcile Deployment due to deletion protection being enabled. see https://dochub.mongodb.org/core/ako-deletion-protection for further information",
247247
)
248-
workflowCtx.SetConditionFromResult(status.DatabaseUserReadyType, result)
248+
workflowCtx.SetConditionFromResult(status.DeploymentReadyType, result)
249249
log.Error(result.GetMessage())
250250

251251
return result

pkg/controller/atlasdeployment/atlasdeployment_controller_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ func TestProtectedAdvancedDeploymentManagedInAtlas(t *testing.T) {
143143
if tc.expectedErr == "" {
144144
assert.True(t, result.IsOk())
145145
} else {
146+
assert.NotNil(t, te.workflowCtx.LastCondition())
147+
if te.workflowCtx.LastCondition() != nil {
148+
assert.Equal(t, status.DeploymentReadyType, te.workflowCtx.LastCondition().Type)
149+
}
146150
assert.Regexp(t, regexp.MustCompile(tc.expectedErr), result.GetMessage())
147151
}
148152
})
@@ -189,6 +193,10 @@ func TestProtectedServerlessManagedInAtlas(t *testing.T) {
189193
if tc.expectedErr == "" {
190194
assert.True(t, result.IsOk())
191195
} else {
196+
assert.NotNil(t, te.workflowCtx.LastCondition())
197+
if te.workflowCtx.LastCondition() != nil {
198+
assert.Equal(t, status.DeploymentReadyType, te.workflowCtx.LastCondition().Type)
199+
}
192200
assert.Regexp(t, regexp.MustCompile(tc.expectedErr), result.GetMessage())
193201
}
194202
})

0 commit comments

Comments
 (0)