Skip to content

Commit

Permalink
Merge pull request #28553 from deads2k/more-data
Browse files Browse the repository at this point in the history
NO-JIRA: fix the static pod lifecycle failure test for more revisions
  • Loading branch information
openshift-merge-bot[bot] committed Feb 1, 2024
2 parents 7599db7 + f6f5bb8 commit 4e368eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -17,7 +17,7 @@ import (
// staticPodFailureRegex trying to pull out information from messages like
// `static pod lifecycle failure - static pod: "etcd" in namespace: "openshift-etcd" for revision: 6 on node: "ovirt10-gh8t5-master-2" didn't show up, waited: 2m30s`
var staticPodFailureRegex = regexp.MustCompile(
`static pod lifecycle failure - static pod: ".*" in namespace: ".*" for revision: (\d) on node: "(.*)" didn't show up, waited: .*`)
`static pod lifecycle failure - static pod: ".*" in namespace: ".*" for revision: (\d+) on node: "(.*)" didn't show up, waited: .*`)

type staticPodFailure struct {
operatorNamespace string
Expand All @@ -29,7 +29,7 @@ type staticPodFailure struct {
func staticPodFailureFromMessage(message string) (*staticPodFailure, error) {
matches := staticPodFailureRegex.FindStringSubmatch(message)
if len(matches) != 3 {
return nil, fmt.Errorf("wrong number of matches: %v", matches)
return nil, fmt.Errorf("wrong number of matches: %v from: %q", matches, message)
}
revision, err := strconv.ParseInt(matches[1], 0, 64)
if err != nil {
Expand Down
Expand Up @@ -24,6 +24,18 @@ func Test_staticPodFailureFromMessage(t *testing.T) {
failureMessage: `static pod lifecycle failure - static pod: "etcd" in namespace: "openshift-etcd" for revision: 6 on node: "ovirt10-gh8t5-master-2" didn't show up, waited: 2m30s`,
},
},
{
name: "I hate regex: metal string",
args: args{
message: `static pod lifecycle failure - static pod: "kube-controller-manager" in namespace: "openshift-kube-controller-manager" for revision: 30 on node: "master-1.ostest.test.metalkube.org" didn't show up, waited: 3m0s`,
},
want: &staticPodFailure{
node: "master-1.ostest.test.metalkube.org",
revision: 30,
failureMessage: `static pod lifecycle failure - static pod: "kube-controller-manager" in namespace: "openshift-kube-controller-manager" for revision: 30 on node: "master-1.ostest.test.metalkube.org" didn't show up, waited: 3m0s`,
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 4e368eb

Please sign in to comment.