Skip to content

Commit

Permalink
chore: remove lingering deployment condition
Browse files Browse the repository at this point in the history
The deployed condition was dropped a while ago, but the condition was
still lingering in some tests.

Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren committed Sep 6, 2024
1 parent 5bf6972 commit 9fab770
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
3 changes: 0 additions & 3 deletions api/v1alpha1/release_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package v1alpha1
import "github.com/konflux-ci/operator-toolkit/conditions"

const (
// deployedConditionType is the type used to track the status of a Release deployment
deployedConditionType conditions.ConditionType = "Deployed"

// postActionsExecutedConditionType is the type used to track the status of Release post-actions
postActionsExecutedConditionType conditions.ConditionType = "PostActionsExecuted"

Expand Down
38 changes: 19 additions & 19 deletions api/v1alpha1/release_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var _ = Describe("Release type", func() {
})

It("should return false when the released condition status is Unknown", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionUnknown, ProgressingReason)
conditions.SetCondition(&release.Status.Conditions, releasedConditionType, metav1.ConditionUnknown, ProgressingReason)
Expect(release.HasReleaseFinished()).To(BeFalse())
})
})
Expand Down Expand Up @@ -866,27 +866,27 @@ var _ = Describe("Release type", func() {
})

It("should return false when the condition is missing", func() {
Expect(release.hasPhaseFinished(deployedConditionType)).To(BeFalse())
Expect(release.hasPhaseFinished(validatedConditionType)).To(BeFalse())
})

It("should return true when the condition status is True", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionTrue, SucceededReason)
Expect(release.hasPhaseFinished(deployedConditionType)).To(BeTrue())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionTrue, SucceededReason)
Expect(release.hasPhaseFinished(validatedConditionType)).To(BeTrue())
})

It("should return false when the condition status is False and the reason is Progressing", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionFalse, ProgressingReason)
Expect(release.hasPhaseFinished(deployedConditionType)).To(BeFalse())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionFalse, ProgressingReason)
Expect(release.hasPhaseFinished(validatedConditionType)).To(BeFalse())
})

It("should return true when the condition status is False and the reason is not Progressing", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionFalse, FailedReason)
Expect(release.hasPhaseFinished(deployedConditionType)).To(BeTrue())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionFalse, FailedReason)
Expect(release.hasPhaseFinished(validatedConditionType)).To(BeTrue())
})

It("should return false when the condition status is Unknown", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionUnknown, ProgressingReason)
Expect(release.hasPhaseFinished(deployedConditionType)).To(BeFalse())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionUnknown, ProgressingReason)
Expect(release.hasPhaseFinished(validatedConditionType)).To(BeFalse())
})
})

Expand All @@ -898,27 +898,27 @@ var _ = Describe("Release type", func() {
})

It("should return false when the condition is missing", func() {
Expect(release.isPhaseProgressing(deployedConditionType)).To(BeFalse())
Expect(release.isPhaseProgressing(validatedConditionType)).To(BeFalse())
})

It("should return false when the condition status is True", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionTrue, SucceededReason)
Expect(release.isPhaseProgressing(deployedConditionType)).To(BeFalse())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionTrue, SucceededReason)
Expect(release.isPhaseProgressing(validatedConditionType)).To(BeFalse())
})

It("should return true when the condition status is False and the reason is Progressing", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionFalse, ProgressingReason)
Expect(release.isPhaseProgressing(deployedConditionType)).To(BeTrue())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionFalse, ProgressingReason)
Expect(release.isPhaseProgressing(validatedConditionType)).To(BeTrue())
})

It("should return false when the condition status is False and the reason is not Progressing", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionFalse, FailedReason)
Expect(release.isPhaseProgressing(deployedConditionType)).To(BeFalse())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionFalse, FailedReason)
Expect(release.isPhaseProgressing(validatedConditionType)).To(BeFalse())
})

It("should return false when the condition status is Unknown", func() {
conditions.SetCondition(&release.Status.Conditions, deployedConditionType, metav1.ConditionUnknown, ProgressingReason)
Expect(release.isPhaseProgressing(deployedConditionType)).To(BeFalse())
conditions.SetCondition(&release.Status.Conditions, validatedConditionType, metav1.ConditionUnknown, ProgressingReason)
Expect(release.isPhaseProgressing(validatedConditionType)).To(BeFalse())
})
})

Expand Down

0 comments on commit 9fab770

Please sign in to comment.