Skip to content

Commit 7e902fe

Browse files
committed
Migrate OCP-55486: check no MountVolume.SetUp failed error in cronjob events
Migrates test from openshift-tests-private to origin. Test validates that cronjob events do not contain the error: "MountVolume.SetUp failed for volume ... object ... not registered" This is a regression test for a bug where volume mounting in cronjobs could fail with an error about unregistered objects. The test: 1. Gets all cronjob namespaces in the cluster 2. Retrieves events from each cronjob namespace 3. Checks for the error pattern using regex 4. Fails if any cronjob events contain the mount error Updates: - Add test to test/extended/node/node_e2e/node.go - Add regexp import for pattern matching - Document test in test/extended/node/README.md
1 parent 38c4fba commit 7e902fe

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

test/extended/node/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This directory contains OpenShift end-to-end tests for node-related features.
1919
- **image_volume.go** - Tests mounting container images as volumes in pods, including subPath and error handling
2020
- **node_swap.go** - Tests default kubelet swap settings (failSwapOn and swapBehavior) and rejection of user overrides
2121
- **zstd_chunked.go** - Tests building and running images with zstd:chunked compression format
22+
- **node_e2e/node.go** - Cronjob volume mount error check (OCP-55486) - Verifies that cronjob events do not contain MountVolume.SetUp failed errors for unregistered objects
2223

2324
## Directory Structure
2425

test/extended/node/node_e2e/node.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"path/filepath"
7+
"regexp"
78
"strings"
89
"time"
910

@@ -164,6 +165,45 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
164165
e2e.Logf("/dev/fuse mount output: %s", output)
165166
o.Expect(output).To(o.ContainSubstring("fuse"), "dev fuse is not mounted inside pod")
166167
})
168+
169+
//author: minmli@redhat.com
170+
//migrated from openshift-tests-private
171+
//automates: https://issues.redhat.com/browse/OCPBUGS-55486
172+
g.It("[OTP] check no MountVolume.SetUp failed error in cronjob events [OCP-55486]", func() {
173+
g.By("Check events in all cronjob namespaces for volume mount errors")
174+
err := wait.Poll(1*time.Second, 10*time.Second, func() (bool, error) {
175+
allCronjobs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cronjob", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.namespace}{\"\\n\"}{end}").Output()
176+
if err != nil {
177+
e2e.Logf("Error getting cronjobs: %v", err)
178+
return false, nil
179+
}
180+
e2e.Logf("Cronjob namespaces: %v", allCronjobs)
181+
182+
for _, ns := range strings.Fields(allCronjobs) {
183+
// Use jsonpath to get event messages directly instead of table output
184+
events, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(
185+
"events", "-n", ns, "-o=jsonpath={range .items[*]}{.message}{\"\\n\"}{end}",
186+
).Output()
187+
if err != nil {
188+
e2e.Logf("Error getting events in namespace %s: %v", ns, err)
189+
continue
190+
}
191+
192+
// Check for the error pattern: MountVolume.SetUp failed for volume ... object ... not registered
193+
errorPattern := regexp.MustCompile(`MountVolume\.SetUp failed for volume.*object.*not registered`)
194+
matches := errorPattern.FindAllString(events, -1)
195+
if len(matches) > 0 {
196+
return false, fmt.Errorf("found mount error in namespace %s: %v", ns, matches[0])
197+
}
198+
}
199+
200+
// Keep polling until timeout - no errors found in this iteration
201+
return false, nil
202+
})
203+
// Expect timeout (no errors found during the full polling window)
204+
o.Expect(err).To(o.HaveOccurred())
205+
o.Expect(err.Error()).To(o.ContainSubstring("timed out"))
206+
})
167207
})
168208

169209
// author: asahay@redhat.com

0 commit comments

Comments
 (0)