@@ -3,6 +3,7 @@ package cvo
33import (
44 "context"
55 "fmt"
6+ "github.com/openshift/cluster-version-operator/pkg/internal"
67 "reflect"
78 "testing"
89 "time"
@@ -112,7 +113,7 @@ func TestOperator_syncFailingStatus(t *testing.T) {
112113 VersionHash : "" ,
113114 Conditions : []configv1.ClusterOperatorStatusCondition {
114115 {Type : configv1 .OperatorAvailable , Status : configv1 .ConditionFalse },
115- {Type : ClusterStatusFailing , Status : configv1 .ConditionTrue , Reason : "UpdatePayloadIntegrity" , Message : "unable to apply object" },
116+ {Type : internal . ClusterStatusFailing , Status : configv1 .ConditionTrue , Reason : "UpdatePayloadIntegrity" , Message : "unable to apply object" },
116117 {Type : configv1 .OperatorProgressing , Status : configv1 .ConditionTrue , Message : "Working towards 4.0.1" },
117118 {Type : configv1 .RetrievedUpdates , Status : configv1 .ConditionFalse },
118119 {Type : "ImplicitlyEnabledCapabilities" , Status : "False" , Reason : "AsExpected" , Message : "Capabilities match configured spec" },
@@ -153,7 +154,7 @@ func TestOperator_syncFailingStatus(t *testing.T) {
153154 VersionHash : "" ,
154155 Conditions : []configv1.ClusterOperatorStatusCondition {
155156 {Type : configv1 .OperatorAvailable , Status : configv1 .ConditionFalse },
156- {Type : ClusterStatusFailing , Status : configv1 .ConditionTrue , Reason : "" , Message : "bad" },
157+ {Type : internal . ClusterStatusFailing , Status : configv1 .ConditionTrue , Reason : "" , Message : "bad" },
157158 {Type : configv1 .OperatorProgressing , Status : configv1 .ConditionTrue , Reason : "" , Message : "Error ensuring the cluster version is up to date: bad" },
158159 {Type : configv1 .RetrievedUpdates , Status : configv1 .ConditionFalse },
159160 {Type : "ImplicitlyEnabledCapabilities" , Status : "False" , Reason : "AsExpected" , Message : "Capabilities match configured spec" },
@@ -252,7 +253,7 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
252253 },
253254 },
254255 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
255- Type : ClusterStatusFailing ,
256+ Type : internal . ClusterStatusFailing ,
256257 Status : configv1 .ConditionFalse ,
257258 },
258259 },
@@ -264,7 +265,7 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
264265 },
265266 },
266267 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
267- Type : ClusterStatusFailing ,
268+ Type : internal . ClusterStatusFailing ,
268269 Status : configv1 .ConditionTrue ,
269270 Message : "error has happened" ,
270271 },
@@ -283,14 +284,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
283284 },
284285 },
285286 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
286- Type : ClusterStatusFailing ,
287+ Type : internal . ClusterStatusFailing ,
287288 Status : configv1 .ConditionTrue ,
288289 Reason : "ClusterOperatorUpdating" ,
289290 Message : "Cluster operator A is updating" ,
290291 },
291292 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
292293 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
293- Type : ClusterStatusFailing ,
294+ Type : internal . ClusterStatusFailing ,
294295 Status : configv1 .ConditionFalse ,
295296 },
296297 expectedProgressingCondition : & configv1.ClusterOperatorStatusCondition {
@@ -314,14 +315,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
314315 },
315316 },
316317 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
317- Type : ClusterStatusFailing ,
318+ Type : internal . ClusterStatusFailing ,
318319 Status : configv1 .ConditionTrue ,
319320 Reason : "ClusterOperatorUpdating" ,
320321 Message : "Cluster operator A is updating" ,
321322 },
322323 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
323324 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
324- Type : ClusterStatusFailing ,
325+ Type : internal . ClusterStatusFailing ,
325326 Status : configv1 .ConditionUnknown ,
326327 Reason : "SlowClusterOperator" ,
327328 Message : "waiting on co-timeout over 30 minutes which is longer than expected" ,
@@ -347,14 +348,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
347348 },
348349 },
349350 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
350- Type : ClusterStatusFailing ,
351+ Type : internal . ClusterStatusFailing ,
351352 Status : configv1 .ConditionTrue ,
352353 Reason : "ClusterOperatorUpdating" ,
353354 Message : "Cluster operator A is updating" ,
354355 },
355356 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
356357 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
357- Type : ClusterStatusFailing ,
358+ Type : internal . ClusterStatusFailing ,
358359 Status : configv1 .ConditionFalse ,
359360 },
360361 expectedProgressingCondition : & configv1.ClusterOperatorStatusCondition {
@@ -379,14 +380,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
379380 },
380381 machineConfigTimeout : true ,
381382 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
382- Type : ClusterStatusFailing ,
383+ Type : internal . ClusterStatusFailing ,
383384 Status : configv1 .ConditionTrue ,
384385 Reason : "ClusterOperatorUpdating" ,
385386 Message : "Cluster operator A is updating" ,
386387 },
387388 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
388389 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
389- Type : ClusterStatusFailing ,
390+ Type : internal . ClusterStatusFailing ,
390391 Status : configv1 .ConditionUnknown ,
391392 Reason : "SlowClusterOperator" ,
392393 Message : "waiting on machine-config over 90 minutes which is longer than expected" ,
@@ -422,7 +423,7 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
422423 },
423424 },
424425 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
425- Type : ClusterStatusFailing ,
426+ Type : internal . ClusterStatusFailing ,
426427 Status : configv1 .ConditionTrue ,
427428 Reason : "ClusterOperatorNotAvailable" ,
428429 Message : "Cluster operators A, B are not available" ,
@@ -452,7 +453,7 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
452453 },
453454 },
454455 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
455- Type : ClusterStatusFailing ,
456+ Type : internal . ClusterStatusFailing ,
456457 Status : configv1 .ConditionTrue ,
457458 Reason : "MultipleErrors" ,
458459 Message : "Multiple errors are preventing progress:\n * Cluster operator A is not available\n * Cluster operator B is degraded" ,
@@ -482,14 +483,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
482483 },
483484 },
484485 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
485- Type : ClusterStatusFailing ,
486+ Type : internal . ClusterStatusFailing ,
486487 Status : configv1 .ConditionTrue ,
487488 Reason : "MultipleErrors" ,
488489 Message : "Multiple errors are preventing progress:\n * Cluster operator A is not available\n * Cluster operator B is updating versions" ,
489490 },
490491 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
491492 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
492- Type : ClusterStatusFailing ,
493+ Type : internal . ClusterStatusFailing ,
493494 Status : configv1 .ConditionTrue ,
494495 Reason : "ClusterOperatorNotAvailable" ,
495496 Message : "Cluster operator A is not available" ,
@@ -519,14 +520,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
519520 },
520521 },
521522 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
522- Type : ClusterStatusFailing ,
523+ Type : internal . ClusterStatusFailing ,
523524 Status : configv1 .ConditionTrue ,
524525 Reason : "MultipleErrors" ,
525526 Message : "Multiple errors are preventing progress:\n * Cluster operator A is updating versions\n * Cluster operator B is getting conscious" ,
526527 },
527528 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
528529 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
529- Type : ClusterStatusFailing ,
530+ Type : internal . ClusterStatusFailing ,
530531 Status : configv1 .ConditionFalse ,
531532 },
532533 },
@@ -559,14 +560,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
559560 },
560561 },
561562 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
562- Type : ClusterStatusFailing ,
563+ Type : internal . ClusterStatusFailing ,
563564 Status : configv1 .ConditionTrue ,
564565 Reason : "MultipleErrors" ,
565566 Message : "Multiple errors are preventing progress:\n * Cluster operator A is not available\n * Cluster operator B is updating versions\n * Cluster operator C is degraded" ,
566567 },
567568 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
568569 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
569- Type : ClusterStatusFailing ,
570+ Type : internal . ClusterStatusFailing ,
570571 Status : configv1 .ConditionTrue ,
571572 Reason : "MultipleErrors" ,
572573 Message : "Multiple errors are preventing progress:\n * Cluster operator A is not available\n * Cluster operator C is degraded" ,
@@ -586,14 +587,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
586587 },
587588 },
588589 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
589- Type : ClusterStatusFailing ,
590+ Type : internal . ClusterStatusFailing ,
590591 Status : configv1 .ConditionTrue ,
591592 Reason : "ClusterOperatorsUpdating" ,
592593 Message : "some-message" ,
593594 },
594595 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
595596 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
596- Type : ClusterStatusFailing ,
597+ Type : internal . ClusterStatusFailing ,
597598 Status : configv1 .ConditionFalse ,
598599 },
599600 expectedProgressingCondition : & configv1.ClusterOperatorStatusCondition {
@@ -617,14 +618,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
617618 },
618619 },
619620 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
620- Type : ClusterStatusFailing ,
621+ Type : internal . ClusterStatusFailing ,
621622 Status : configv1 .ConditionTrue ,
622623 Reason : "ClusterOperatorsUpdating" ,
623624 Message : "some-message" ,
624625 },
625626 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
626627 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
627- Type : ClusterStatusFailing ,
628+ Type : internal . ClusterStatusFailing ,
628629 Status : configv1 .ConditionUnknown ,
629630 Reason : "SlowClusterOperator" ,
630631 Message : "waiting on co-timeout over 30 minutes which is longer than expected" ,
@@ -650,14 +651,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
650651 },
651652 },
652653 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
653- Type : ClusterStatusFailing ,
654+ Type : internal . ClusterStatusFailing ,
654655 Status : configv1 .ConditionTrue ,
655656 Reason : "ClusterOperatorsUpdating" ,
656657 Message : "some-message" ,
657658 },
658659 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
659660 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
660- Type : ClusterStatusFailing ,
661+ Type : internal . ClusterStatusFailing ,
661662 Status : configv1 .ConditionUnknown ,
662663 Reason : "SlowClusterOperator" ,
663664 Message : "waiting on co-timeout, co-bar-timeout over 30 minutes which is longer than expected" ,
@@ -684,14 +685,14 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
684685 },
685686 machineConfigTimeout : true ,
686687 expectedConditionNotModified : & configv1.ClusterOperatorStatusCondition {
687- Type : ClusterStatusFailing ,
688+ Type : internal . ClusterStatusFailing ,
688689 Status : configv1 .ConditionTrue ,
689690 Reason : "ClusterOperatorsUpdating" ,
690691 Message : "some-message" ,
691692 },
692693 shouldModifyWhenNotReconcilingAndHistoryNotEmpty : true ,
693694 expectedConditionModified : & configv1.ClusterOperatorStatusCondition {
694- Type : ClusterStatusFailing ,
695+ Type : internal . ClusterStatusFailing ,
695696 Status : configv1 .ConditionUnknown ,
696697 Reason : "SlowClusterOperator" ,
697698 Message : "waiting on co-timeout, co-bar-timeout over 30 minutes and machine-config over 90 minutes which is longer than expected" ,
@@ -742,7 +743,7 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
742743 expectedCondition = tc .expectedConditionModified
743744 }
744745 updateClusterVersionStatus (cvStatus , tc .args .syncWorkerStatus , release , getAvailableUpdates , gates , noErrors )
745- condition := resourcemerge .FindOperatorStatusCondition (cvStatus .Conditions , ClusterStatusFailing )
746+ condition := resourcemerge .FindOperatorStatusCondition (cvStatus .Conditions , internal . ClusterStatusFailing )
746747 if diff := cmp .Diff (expectedCondition , condition , ignoreLastTransitionTime ); diff != "" {
747748 t .Errorf ("unexpected condition when Reconciling == %t && isHistoryEmpty == %t\n :%s" , c .isReconciling , c .isHistoryEmpty , diff )
748749 }
0 commit comments