Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/extended/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This directory contains OpenShift end-to-end tests for node-related features.
- **image_volume.go** - Tests mounting container images as volumes in pods, including subPath and error handling
- **node_swap.go** - Tests default kubelet swap settings (failSwapOn and swapBehavior) and rejection of user overrides
- **zstd_chunked.go** - Tests building and running images with zstd:chunked compression format
- **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

## Directory Structure

Expand Down
38 changes: 38 additions & 0 deletions test/extended/node/node_e2e/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"path/filepath"
"regexp"
"strings"
"time"

Expand Down Expand Up @@ -164,6 +165,43 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
e2e.Logf("/dev/fuse mount output: %s", output)
o.Expect(output).To(o.ContainSubstring("fuse"), "dev fuse is not mounted inside pod")
})

//author: bgudi@redhat.com
g.It("[OTP][Late] Cronjob events should not contain MountVolume.SetUp failed errors [OCP-55486]", func() {
g.By("Check events in all cronjob namespaces for volume mount errors")
err := wait.Poll(1*time.Second, 10*time.Second, func() (bool, error) {
allCronjobs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cronjob", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.namespace}{\"\\n\"}{end}").Output()
if err != nil {
e2e.Logf("Error getting cronjobs: %v", err)
return false, nil
}
e2e.Logf("Cronjob namespaces: %v", allCronjobs)

for _, ns := range strings.Fields(allCronjobs) {
// Use jsonpath to get event messages directly instead of table output
events, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(
"events", "-n", ns, "-o=jsonpath={range .items[*]}{.message}{\"\\n\"}{end}",
).Output()
if err != nil {
e2e.Logf("Error getting events in namespace %s: %v", ns, err)
continue
}

// Check for the error pattern: MountVolume.SetUp failed for volume ... object ... not registered
errorPattern := regexp.MustCompile(`MountVolume\.SetUp failed for volume.*object.*not registered`)
matches := errorPattern.FindAllString(events, -1)
if len(matches) > 0 {
return false, fmt.Errorf("found mount error in namespace %s: %v", ns, matches[0])
}
}

// Keep polling until timeout - no errors found in this iteration
return false, nil
})
// Expect timeout (no errors found during the full polling window)
o.Expect(err).To(o.HaveOccurred())
o.Expect(err.Error()).To(o.ContainSubstring("timed out"))
})
})

// author: asahay@redhat.com
Expand Down