Skip to content

Commit 578bc33

Browse files
committed
Count CO correctly
1 parent 4caa6c1 commit 578bc33

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ func (w *monitor) controlPlane() *junitapi.JUnitTestCase {
100100
}
101101

102102
items := len(strings.Split(updatingOperators, ","))
103-
// TODO: These should actually exactly match, but `oc adm upgrade status` emits operators with linebreaks in
104-
// messages in a crappy way which we will need to fix
105-
if len(cp.Operators) < items {
103+
if len(cp.Operators) != items {
106104
fail(fmt.Sprintf("Control plane summary contains Updating key with %d operators but operators section has %d items", items, len(cp.Operators)))
107105
continue
108106
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,17 @@ func (p *parser) parseControlPlaneOperators() ([]string, error) {
260260
var operators []string
261261

262262
for {
263-
line, done := p.next()
263+
line, done := p.next(preserveLeadingWhitespace)
264264
if done || line == "" {
265265
break
266266
}
267-
268-
operators = append(operators, line)
267+
trimLeft := strings.TrimLeft(line, " \t")
268+
if len(operators) == 0 || line == trimLeft {
269+
operators = append(operators, line)
270+
} else {
271+
last := len(operators) - 1
272+
operators[last] = fmt.Sprintf("%s\n%s", operators[last], trimLeft)
273+
}
269274
}
270275

271276
if len(operators) == 0 {

0 commit comments

Comments
 (0)