Skip to content

Commit 84fa429

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 84fa429

2 files changed

Lines changed: 39 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: 38 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,43 @@ 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: bgudi@redhat.com
170+
g.It("[OTP][Late] Cronjob events should not contain MountVolume.SetUp failed errors [OCP-55486]", func() {
171+
g.By("Check events in all cronjob namespaces for volume mount errors")
172+
err := wait.Poll(1*time.Second, 10*time.Second, func() (bool, error) {
173+
allCronjobs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cronjob", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.namespace}{\"\\n\"}{end}").Output()
174+
if err != nil {
175+
e2e.Logf("Error getting cronjobs: %v", err)
176+
return false, nil
177+
}
178+
e2e.Logf("Cronjob namespaces: %v", allCronjobs)
179+
180+
for _, ns := range strings.Fields(allCronjobs) {
181+
// Use jsonpath to get event messages directly instead of table output
182+
events, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(
183+
"events", "-n", ns, "-o=jsonpath={range .items[*]}{.message}{\"\\n\"}{end}",
184+
).Output()
185+
if err != nil {
186+
e2e.Logf("Error getting events in namespace %s: %v", ns, err)
187+
continue
188+
}
189+
190+
// Check for the error pattern: MountVolume.SetUp failed for volume ... object ... not registered
191+
errorPattern := regexp.MustCompile(`MountVolume\.SetUp failed for volume.*object.*not registered`)
192+
matches := errorPattern.FindAllString(events, -1)
193+
if len(matches) > 0 {
194+
return false, fmt.Errorf("found mount error in namespace %s: %v", ns, matches[0])
195+
}
196+
}
197+
198+
// Keep polling until timeout - no errors found in this iteration
199+
return false, nil
200+
})
201+
// Expect timeout (no errors found during the full polling window)
202+
o.Expect(err).To(o.HaveOccurred())
203+
o.Expect(err.Error()).To(o.ContainSubstring("timed out"))
204+
})
167205
})
168206

169207
// author: asahay@redhat.com

0 commit comments

Comments
 (0)