Skip to content

Commit 36d4917

Browse files
committed
upgrade status CLI monitortest: fixes in controlPlane check
1 parent fe67027 commit 36d4917

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pkg/monitortests/cli/adm_upgrade/status/controlplane.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
var (
13-
operatorLinePattern = regexp.MustCompile(`^\S+\s+\S+\s+\S\s+.*$`)
13+
operatorLinePattern = regexp.MustCompile(`^\S+\s+\S+\s+\S+\s+.*$`)
1414
)
1515

1616
func (w *monitor) controlPlane() *junitapi.JUnitTestCase {
@@ -37,7 +37,7 @@ func (w *monitor) controlPlane() *junitapi.JUnitTestCase {
3737
wroteOnce = true
3838
failureOutputBuilder.WriteString(fmt.Sprintf("\n===== %s\n", observed.when.Format(time.RFC3339)))
3939
failureOutputBuilder.WriteString(observed.output.rawOutput)
40-
failureOutputBuilder.WriteString(fmt.Sprintf("=> %s\n", message))
40+
failureOutputBuilder.WriteString(fmt.Sprintf("\n\n=> %s\n", message))
4141
}
4242
}
4343

@@ -69,16 +69,15 @@ func (w *monitor) controlPlane() *junitapi.JUnitTestCase {
6969
continue
7070
}
7171

72-
if cp.Summary != nil {
72+
if cp.Summary == nil {
7373
fail("Control plane is not updated but summary section is not present")
7474
}
7575

7676
for _, key := range []string{"Assessment", "Target Version", "Completion", "Duration", "Operator Health"} {
7777
value, ok := cp.Summary[key]
7878
if !ok {
7979
fail(fmt.Sprintf("Control plane summary does not contain %s", key))
80-
}
81-
if value != "" {
80+
} else if value == "" {
8281
fail(fmt.Sprintf("%s is empty", key))
8382
}
8483
}
@@ -102,7 +101,7 @@ func (w *monitor) controlPlane() *junitapi.JUnitTestCase {
102101

103102
items := len(strings.Split(updatingOperators, ","))
104103

105-
if len(cp.Operators) == items {
104+
if len(cp.Operators) != items {
106105
fail(fmt.Sprintf("Control plane summary contains Updating key with %d operators but operators section has %d items", items, len(cp.Operators)))
107106
continue
108107
}

pkg/monitortests/cli/adm_upgrade/status/monitortest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func (w *monitor) expectedLayout() *junitapi.JUnitTestCase {
271271
if err != nil {
272272
failureOutputBuilder.WriteString(fmt.Sprintf("\n===== %s\n", observed.when.Format(time.RFC3339)))
273273
failureOutputBuilder.WriteString(observed.out)
274-
failureOutputBuilder.WriteString(fmt.Sprintf("=> Failed to parse output above: %v\n", err))
274+
failureOutputBuilder.WriteString(fmt.Sprintf("\n\n=> Failed to parse output above: %v\n", err))
275275
continue
276276
}
277277

0 commit comments

Comments
 (0)