Skip to content

Commit 8552999

Browse files
committed
terminationmessagepolicy: correctly fail on violations
1 parent 7da3e1c commit 8552999

File tree

1 file changed

+3
-6
lines changed
  • pkg/monitortests/clusterversionoperator/terminationmessagepolicy

1 file changed

+3
-6
lines changed

pkg/monitortests/clusterversionoperator/terminationmessagepolicy/monitortest.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package terminationmessagepolicy
33
import (
44
"context"
55
"fmt"
6+
"regexp"
67
"strings"
78
"time"
89

@@ -27,11 +28,6 @@ func init() {
2728
for i := 0; i < 16; i++ {
2829
unfixedVersions.Insert(fmt.Sprintf("4.%d", i))
2930
}
30-
31-
// TODO: [lmeyer 2026-04-08] replace this temporary hack.
32-
unfixedVersions.Insert("5.0")
33-
// the algorithm below has permitted every release since 4.20 to flake because "4.2" is in the version.
34-
// predictably, a number of violations have crept in. once those are fixed, fix hasOldVersion determination below.
3531
}
3632

3733
type terminationMessagePolicyChecker struct {
@@ -67,7 +63,8 @@ func (w *terminationMessagePolicyChecker) StartCollection(ctx context.Context, a
6763

6864
for _, history := range clusterVersion.Status.History {
6965
for _, unfixedVersion := range unfixedVersions.List() {
70-
if strings.Contains(history.Version, unfixedVersion) {
66+
matcher, err := regexp.Compile(fmt.Sprintf(`\b%s\b`, unfixedVersion))
67+
if err != nil || matcher.MatchString(history.Version) {
7168
w.hasOldVersion = true
7269
break
7370
}

0 commit comments

Comments
 (0)