Skip to content

Commit 7d824bf

Browse files
committed
Address comments from review
1 parent 8257b5c commit 7d824bf

File tree

1 file changed

+17
-15
lines changed
  • pkg/monitortests/clusterversionoperator/legacycvomonitortests

1 file changed

+17
-15
lines changed

pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,6 @@ func testOperatorStateTransitions(events monitorapi.Intervals, conditionTypes []
516516
for _, conditionType := range conditionTypes {
517517
for _, operatorName := range platformidentification.KnownOperators.List() {
518518
bzComponent := platformidentification.GetBugzillaComponentForOperator(operatorName)
519-
if bzComponent == "Unknown" {
520-
bzComponent = operatorName
521-
}
522519
testName := fmt.Sprintf("[bz-%v] clusteroperator/%v should not change condition/%v", bzComponent, operatorName, conditionType)
523520
operatorEvents := eventsByOperator[operatorName]
524521
if len(operatorEvents) == 0 {
@@ -600,8 +597,12 @@ func testOperatorStateTransitions(events monitorapi.Intervals, conditionTypes []
600597
}
601598

602599
if len(fatal) == 0 {
603-
// add a success so we flake (or pass) and don't fail
604-
ret = append(ret, &junitapi.JUnitTestCase{Name: testName})
600+
if len(excepted) > 0 {
601+
// add a success so we flake (or pass) and don't fail
602+
ret = append(ret, &junitapi.JUnitTestCase{Name: testName, SystemOut: "Passing the case to make the overall test case flake as the previous failure is expected"})
603+
} else {
604+
ret = append(ret, &junitapi.JUnitTestCase{Name: testName})
605+
}
605606
}
606607
}
607608
}
@@ -613,7 +614,7 @@ func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Interv
613614
var ret []*junitapi.JUnitTestCase
614615
upgradeWindows := getUpgradeWindows(events)
615616

616-
var machineConfigProgressing time.Time
617+
var machineConfigProgressingStart time.Time
617618
var eventsInUpgradeWindows monitorapi.Intervals
618619

619620
var start, stop time.Time
@@ -638,7 +639,7 @@ func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Interv
638639
continue // ignore non-condition intervals
639640
}
640641
if condition.Type == configv1.OperatorProgressing && condition.Status == configv1.ConditionTrue {
641-
machineConfigProgressing = mcEvent.To
642+
machineConfigProgressingStart = mcEvent.To
642643
break
643644
}
644645
}
@@ -647,21 +648,18 @@ func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Interv
647648
Name: fmt.Sprintf("[bz-Machine Config Operator] clusteroperator/machine-config must go Progressing=True during an upgrade test"),
648649
Duration: duration,
649650
}
650-
if machineConfigProgressing.IsZero() {
651+
if machineConfigProgressingStart.IsZero() {
651652
mcTestCase.FailureOutput = &junitapi.FailureOutput{
652653
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)),
653654
}
654655
return []*junitapi.JUnitTestCase{mcTestCase}
655656
} else {
656-
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))
657+
mcTestCase.SystemOut = fmt.Sprintf("machine-config became Progressing=True at %s during the upgrade window from %s to %s", machineConfigProgressingStart.Format(time.RFC3339), start.Format(time.RFC3339), stop.Format(time.RFC3339))
657658
}
658659
ret = append(ret, mcTestCase)
659660

660661
for _, operatorName := range platformidentification.KnownOperators.Difference(sets.NewString("machine-config")).List() {
661662
bzComponent := platformidentification.GetBugzillaComponentForOperator(operatorName)
662-
if bzComponent == "Unknown" {
663-
bzComponent = operatorName
664-
}
665663
testName := fmt.Sprintf("[bz-%v] clusteroperator/%v should stay Progressing=False while MCO is Progressing=True", bzComponent, operatorName)
666664
operatorEvents := eventsByOperator[operatorName]
667665
if len(operatorEvents) == 0 {
@@ -731,7 +729,7 @@ func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Interv
731729

732730
var excepted, fatal []string
733731
for _, operatorEvent := range operatorEvents {
734-
if operatorEvent.From.Before(machineConfigProgressing) {
732+
if operatorEvent.From.Before(machineConfigProgressingStart) {
735733
continue
736734
}
737735
condition := monitorapi.GetOperatorConditionStatus(operatorEvent)
@@ -786,8 +784,12 @@ func clusterOperatorIsNotProgressingWhenMachineConfigIs(events monitorapi.Interv
786784
}
787785

788786
if len(fatal) == 0 {
789-
// add a success so we flake (or pass) and don't fail
790-
ret = append(ret, &junitapi.JUnitTestCase{Name: testName})
787+
if len(excepted) > 0 {
788+
// add a success so we flake (or pass) and don't fail
789+
ret = append(ret, &junitapi.JUnitTestCase{Name: testName, SystemOut: "Passing the case to make the overall test case flake as the previous failure is expected"})
790+
} else {
791+
ret = append(ret, &junitapi.JUnitTestCase{Name: testName})
792+
}
791793
}
792794
}
793795

0 commit comments

Comments
 (0)