Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove lingering deployment condition #557

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading