-
Notifications
You must be signed in to change notification settings - Fork 71
TEST - IGNORE #2474
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
TEST - IGNORE #2474
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -253,6 +253,107 @@ func TestSetStatusConditionWrapper(t *testing.T) { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| func TestSetInstalledStatusFromRevisionStates_Upgrade(t *testing.T) { | ||||||
| tests := []struct { | ||||||
| name string | ||||||
| revisionStates *RevisionStates | ||||||
| expectedInstalledCond metav1.Condition | ||||||
| }{ | ||||||
| { | ||||||
| name: "installed bundle with healthy upgrade in progress - uses Upgrading", | ||||||
| revisionStates: &RevisionStates{ | ||||||
| Installed: &RevisionMetadata{ | ||||||
| RevisionName: "rev-1", | ||||||
| Image: "quay.io/example/bundle:v1.0.0", | ||||||
| BundleMetadata: ocv1.BundleMetadata{ | ||||||
| Name: "example.v1.0.0", | ||||||
| Version: "1.0.0", | ||||||
| }, | ||||||
| }, | ||||||
| RollingOut: []*RevisionMetadata{ | ||||||
| { | ||||||
| RevisionName: "rev-2", | ||||||
| Conditions: []metav1.Condition{ | ||||||
| { | ||||||
| Type: ocv1.ClusterExtensionRevisionTypeProgressing, | ||||||
| Status: metav1.ConditionTrue, | ||||||
| Reason: ocv1.ReasonRollingOut, | ||||||
| Message: "Upgrading to v2.0.0", | ||||||
| }, | ||||||
| }, | ||||||
| }, | ||||||
| }, | ||||||
| }, | ||||||
| expectedInstalledCond: metav1.Condition{ | ||||||
| Type: ocv1.TypeInstalled, | ||||||
| Status: metav1.ConditionTrue, | ||||||
| Reason: ocv1.ReasonUpgrading, | ||||||
| }, | ||||||
| }, | ||||||
| { | ||||||
| name: "installed bundle with no rolling revisions - uses Succeeded", | ||||||
| revisionStates: &RevisionStates{ | ||||||
| Installed: &RevisionMetadata{ | ||||||
| RevisionName: "rev-1", | ||||||
| Image: "quay.io/example/bundle:v1.0.0", | ||||||
| BundleMetadata: ocv1.BundleMetadata{ | ||||||
| Name: "example.v1.0.0", | ||||||
| Version: "1.0.0", | ||||||
| }, | ||||||
| }, | ||||||
| RollingOut: nil, | ||||||
| }, | ||||||
| expectedInstalledCond: metav1.Condition{ | ||||||
| Type: ocv1.TypeInstalled, | ||||||
| Status: metav1.ConditionTrue, | ||||||
| Reason: ocv1.ReasonSucceeded, | ||||||
| }, | ||||||
| }, | ||||||
| { | ||||||
| name: "installed bundle with rolling revision not yet healthy - uses Succeeded", | ||||||
| revisionStates: &RevisionStates{ | ||||||
| Installed: &RevisionMetadata{ | ||||||
| RevisionName: "rev-1", | ||||||
| Image: "quay.io/example/bundle:v1.0.0", | ||||||
| BundleMetadata: ocv1.BundleMetadata{ | ||||||
| Name: "example.v1.0.0", | ||||||
| Version: "1.0.0", | ||||||
| }, | ||||||
| }, | ||||||
| RollingOut: []*RevisionMetadata{ | ||||||
| { | ||||||
| RevisionName: "rev-2", | ||||||
| Conditions: []metav1.Condition{}, | ||||||
| }, | ||||||
| }, | ||||||
| }, | ||||||
| expectedInstalledCond: metav1.Condition{ | ||||||
| Type: ocv1.TypeInstalled, | ||||||
| Status: metav1.ConditionTrue, | ||||||
| Reason: ocv1.ReasonSucceeded, | ||||||
| }, | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| for _, tt := range tests { | ||||||
| t.Run(tt.name, func(t *testing.T) { | ||||||
| ext := &ocv1.ClusterExtension{ | ||||||
| ObjectMeta: metav1.ObjectMeta{ | ||||||
| Name: "test-ext", | ||||||
| Generation: 1, | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| setInstalledStatusFromRevisionStates(ext, tt.revisionStates) | ||||||
|
|
||||||
| cond := meta.FindStatusCondition(ext.Status.Conditions, ocv1.TypeInstalled) | ||||||
| require.NotNil(t, cond) | ||||||
| require.Equal(t, tt.expectedInstalledCond.Status, cond.Status) | ||||||
| require.Equal(t, tt.expectedInstalledCond.Reason, cond.Reason) | ||||||
| }) | ||||||
| } | ||||||
| } | ||||||
|
Comment on lines
+256
to
+355
|
||||||
|
|
||||||
| func TestSetInstalledStatusFromRevisionStates_ConfigValidationError(t *testing.T) { | ||||||
|
||||||
| func TestSetInstalledStatusFromRevisionStates_ConfigValidationError(t *testing.T) { | |
| func TestSetInstalledStatusFromRevisionStates_NoInstalledBundle(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for upgrade status on line 75 only verifies that progressingCond.Reason equals RollingOut, but doesn't verify the condition Status. This could potentially report Upgrading even if the condition status is False or Unknown. Consider adding a check for progressingCond.Status == metav1.ConditionTrue to ensure the upgrade is actually progressing successfully before reporting the Upgrading status.