Skip to content

Commit b188bf9

Browse files
committed
OTA-1643: Each CO must go Progressing during upgrade
1 parent 603cedb commit b188bf9

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

pkg/monitortests/clusterversionoperator/legacycvomonitortests/monitortest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (w *legacyMonitorTests) EvaluateTestsFromConstructedIntervals(ctx context.C
4545
isUpgrade := platformidentification.DidUpgradeHappenDuringCollection(finalIntervals, time.Time{}, time.Time{})
4646
if isUpgrade {
4747
junits = append(junits, testUpgradeOperatorStateTransitions(finalIntervals, w.adminRESTConfig)...)
48-
junits = append(junits, clusterOperatorIsNotProgressingWhenMachineConfigIs(finalIntervals)...)
48+
junits = append(junits, testUpgradeOperatorProgressingStateTransitions(finalIntervals)...)
4949
} else {
5050
junits = append(junits, testStableSystemOperatorStateTransitions(finalIntervals, w.adminRESTConfig)...)
5151
}

pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -599,13 +599,11 @@ func testOperatorStateTransitions(events monitorapi.Intervals, conditionTypes []
599599
return ret
600600
}
601601

602-
func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Intervals) []*junitapi.JUnitTestCase {
602+
func testUpgradeOperatorProgressingStateTransitions(events monitorapi.Intervals) []*junitapi.JUnitTestCase {
603603
var ret []*junitapi.JUnitTestCase
604604
upgradeWindows := getUpgradeWindows(events)
605605

606-
var machineConfigProgressing time.Time
607606
var eventsInUpgradeWindows monitorapi.Intervals
608-
609607
var start, stop time.Time
610608
for _, event := range events {
611609
if !isInUpgradeWindow(upgradeWindows, event) {
@@ -622,31 +620,50 @@ func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Interv
622620
duration := stop.Sub(start).Seconds()
623621

624622
eventsByOperator := getEventsByOperator(eventsInUpgradeWindows)
625-
for _, mcEvent := range eventsByOperator["machine-config"] {
626-
condition := monitorapi.GetOperatorConditionStatus(mcEvent)
627-
if condition == nil {
628-
continue // ignore non-condition intervals
629-
}
630-
if condition.Type == configv1.OperatorProgressing && condition.Status == configv1.ConditionTrue {
631-
machineConfigProgressing = mcEvent.To
632-
break
623+
coProgressing := map[string]time.Time{}
624+
for _, operatorName := range platformidentification.KnownOperators.List() {
625+
for _, mcEvent := range eventsByOperator[operatorName] {
626+
condition := monitorapi.GetOperatorConditionStatus(mcEvent)
627+
if condition == nil {
628+
continue // ignore non-condition intervals
629+
}
630+
if condition.Type == configv1.OperatorProgressing && condition.Status == configv1.ConditionTrue {
631+
coProgressing[operatorName] = mcEvent.To
632+
break
633+
}
633634
}
634635
}
635636

636-
mcTestCase := &junitapi.JUnitTestCase{
637-
Name: fmt.Sprintf("[bz-Machine Config Operator] clusteroperator/machine-config must go Progressing=True during an upgrade test"),
638-
Duration: duration,
637+
// Each cluster operator must report Progressing=True during cluster upgrade
638+
var machineConfigProgressing time.Time
639+
for _, operatorName := range platformidentification.KnownOperators.List() {
640+
bzComponent := platformidentification.GetBugzillaComponentForOperator(operatorName)
641+
if bzComponent == "Unknown" {
642+
bzComponent = operatorName
643+
}
644+
mcTestCase := &junitapi.JUnitTestCase{
645+
Name: fmt.Sprintf("[bz-%s] clusteroperator/%s must go Progressing=True during an upgrade test", bzComponent, operatorName),
646+
Duration: duration,
647+
}
648+
649+
if t, ok := coProgressing[operatorName]; !ok || t.IsZero() {
650+
mcTestCase.FailureOutput = &junitapi.FailureOutput{
651+
Output: fmt.Sprintf("clusteroperator/%s was never Progressing=True during the upgrade window from %s to %s", operatorName, start.Format(time.RFC3339), stop.Format(time.RFC3339)),
652+
}
653+
} else {
654+
if operatorName == "machine-config" {
655+
machineConfigProgressing = t
656+
}
657+
mcTestCase.SystemOut = fmt.Sprintf("clusteroperator/%s became Progressing=True at %s during the upgrade window from %s to %s", operatorName, t.Format(time.RFC3339), start.Format(time.RFC3339), stop.Format(time.RFC3339))
658+
}
659+
ret = append(ret, mcTestCase)
639660
}
661+
640662
if machineConfigProgressing.IsZero() {
641-
mcTestCase.FailureOutput = &junitapi.FailureOutput{
642-
Output: fmt.Sprintf("machine-config was never Progressing=True during the upgrade window from %s to %s", start.Format(time.RFC3339), stop.Format(time.RFC3339)),
643-
}
644-
return []*junitapi.JUnitTestCase{mcTestCase}
645-
} else {
646-
mcTestCase.SystemOut = fmt.Sprintf("machine-config became Progressing=True at %s during the upgrade window from %s to %s", machineConfigProgressing.Format(time.RFC3339), start.Format(time.RFC3339), stop.Format(time.RFC3339))
663+
return ret
647664
}
648-
ret = append(ret, mcTestCase)
649665

666+
// No cluster operator report Progressing=True when machine-config does
650667
for _, operatorName := range platformidentification.KnownOperators.Difference(sets.NewString("machine-config")).List() {
651668
bzComponent := platformidentification.GetBugzillaComponentForOperator(operatorName)
652669
if bzComponent == "Unknown" {

0 commit comments

Comments
 (0)