Skip to content
Merged
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
41 changes: 40 additions & 1 deletion test/extended/node/node_e2e/node.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package node

import (
"path/filepath"
"strings"
"time"

Expand All @@ -14,7 +15,9 @@ import (

var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager", func() {
var (
oc = exutil.NewCLIWithoutNamespace("node")
oc = exutil.NewCLIWithoutNamespace("node")
nodeE2EBaseDir = exutil.FixturePath("testdata", "node", "node_e2e")
podDevFuseYAML = filepath.Join(nodeE2EBaseDir, "pod-dev-fuse.yaml")
)

// Skip all tests on MicroShift clusters as MachineConfig resources are not available
Expand Down Expand Up @@ -103,4 +106,40 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
o.Expect(err).Should(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("spec.cgroupMode: Unsupported value: \"v1\": supported values: \"v2\", \"\""))
})

//author: cmaurya@redhat.com
g.It("[OTP] Allow dev fuse by default in CRI-O [OCP-70987]", func() {
podName := "pod-devfuse"
ns := "devfuse-test"

g.By("Create a test namespace")
err := oc.AsAdmin().WithoutNamespace().Run("create").Args("namespace", ns).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("namespace", ns, "--ignore-not-found").Execute()

g.By("Create a pod with dev fuse annotation")
err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", podDevFuseYAML, "-n", ns).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

g.By("Wait for pod to be ready")
err = wait.Poll(5*time.Second, 1*time.Minute, func() (bool, error) {
status, pollErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", podName, "-n", ns, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
if pollErr != nil {
e2e.Logf("Error polling pod status: %v", pollErr)
return false, nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the pod fails to schedule or has errors, the test will just time out after 1 minute with no diagnostic info. Consider logging the error or the pod's status/events on failure to aid debugging:

if pollErr != nil {
    e2e.Logf("Error polling pod status: %v", pollErr)
    return false, nil
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in the latest commit.

}
return status == "True", nil
})
if err != nil {
podStatus, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", podName, "-n", ns, "-o=jsonpath={.status}").Output()
e2e.Logf("Pod status on timeout: %s", podStatus)
}
o.Expect(err).NotTo(o.HaveOccurred(), "pod did not become ready")

g.By("Check /dev/fuse is mounted inside the pod")
output, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(podName, "-n", ns, "--", "stat", "/dev/fuse").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("/dev/fuse mount output: %s", output)
o.Expect(output).To(o.ContainSubstring("fuse"), "dev fuse is not mounted inside pod")
})
})
42 changes: 42 additions & 0 deletions test/extended/testdata/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions test/extended/testdata/node/node_e2e/pod-dev-fuse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Pod
metadata:
name: pod-devfuse
annotations:
io.kubernetes.cri-o.Devices: "/dev/fuse"
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: pod-devfuse
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
command: ["sleep", "infinity"]
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL