Skip to content

Commit cf7004b

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 cf7004b

2 files changed

Lines changed: 31 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: 30 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,35 @@ 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+
o.Expect(err).NotTo(o.HaveOccurred())
177+
e2e.Logf("Cronjob namespaces: %v", allCronjobs)
178+
179+
for _, ns := range strings.Fields(allCronjobs) {
180+
events, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("events", "-n", ns).Output()
181+
o.Expect(err).NotTo(o.HaveOccurred())
182+
183+
// Check for the error pattern: MountVolume.SetUp failed for volume ... object ... not registered
184+
errorPattern := regexp.MustCompile(`MountVolume\.SetUp failed for volume.*object.*not registered`)
185+
matches := errorPattern.FindAllString(events, -1)
186+
if len(matches) > 0 {
187+
e2e.Logf("Found mount error in namespace %s: %v", ns, matches[0])
188+
return false, nil
189+
}
190+
}
191+
192+
e2e.Logf("No MountVolume.SetUp errors found in cronjob events")
193+
return true, nil
194+
})
195+
o.Expect(err).NotTo(o.HaveOccurred(), "Found MountVolume.SetUp failed error in cronjob events")
196+
})
167197
})
168198

169199
// author: asahay@redhat.com

0 commit comments

Comments
 (0)