Skip to content

Commit baf6fa9

Browse files
author
Kasturi Narra
committed
Add test to verify count in GDP config
1 parent 1bea7d5 commit baf6fa9

File tree

2 files changed

+61
-5
lines changed

2 files changed

+61
-5
lines changed

test/suites/optional/generic-device-plugin.robot

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ Verify ttyUSB glob pattern device discovery and allocation
4949

5050
[Teardown] TtyUSB Glob Test Teardown
5151

52+
Verify FUSE device allocation and accessibility
53+
[Documentation] Verifies FUSE device configuration, allocation, and accessibility in pods
54+
[Tags] fuse-device
55+
Enable And Configure GDP ${GDP_CONFIG_FUSE_COUNT}
56+
Wait Until Device Is Allocatable 10 fuse
57+
# Create and deploy pod requesting 4 FUSE devices
58+
${path}= Create Random Temp File ${POD_FUSE_DEVICE}
59+
Oc Create -f ${path} -n ${NAMESPACE}
60+
61+
# Wait for pod to be ready and verify device accessibility
62+
Oc Wait -n ${NAMESPACE} pod/fuse-test-pod --for=condition=Ready --timeout=120s
63+
64+
# Verify /dev/fuse is accessible in the pod
65+
${fuse_device}= Run With Kubeconfig oc exec -n ${NAMESPACE} fuse-test-pod -- ls -l /dev/fuse
66+
Should Contain ${fuse_device} /dev/fuse
67+
68+
# Verify node allocation shows 4 FUSE devices allocated
69+
${node}= Run With Kubeconfig oc get node -o=name
70+
${node_name}= Remove String ${node} node/
71+
${describe_output}= Run With Kubeconfig oc describe node ${node_name}
72+
Should Contain ${describe_output} device.microshift.io/fuse: 10
73+
Should Contain ${describe_output} device.microshift.io/fuse 4 4
74+
5275

5376
*** Keywords ***
5477
GDP Test Setup
@@ -132,20 +155,20 @@ Create Test Job With Modified Script
132155

133156
Wait Until Device Is Allocatable
134157
[Documentation] Waits until device device.microshift.io/fakeserial is allocatable
135-
[Arguments] ${expected_count}=1
158+
[Arguments] ${expected_count}=1 ${device_type}=fakeserial
136159
${node}= Run With Kubeconfig oc get node -o=name
137160
${node_name}= Remove String ${node} node/
138161
Wait Until Keyword Succeeds 60s 5s
139-
... Device Should Be Allocatable ${node_name} ${expected_count}
162+
... Device Should Be Allocatable ${node_name} ${expected_count} ${device_type}
140163

141164
Device Should Be Allocatable
142-
[Documentation] Checks if device device.microshift.io/fakeserial is allocatable
143-
[Arguments] ${node_name} ${expected_count}=1
165+
[Documentation] Checks if specified device is allocatable
166+
[Arguments] ${node_name} ${expected_count}=1 ${device_type}=fakeserial
144167
${device_amount}= Oc Get JsonPath
145168
... node
146169
... ${EMPTY}
147170
... ${node_name}
148-
... .status.allocatable.device\\.microshift\\.io/fakeserial
171+
... .status.allocatable.device\\.microshift\\.io/${device_type}
149172
Should Be Equal As Integers ${device_amount} ${expected_count}
150173

151174
Wait For Job Completion And Check Logs

test/suites/optional/strings.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,39 @@
2929
- path: /dev/ttyUSB*
3030
'''
3131

32+
GDP_CONFIG_FUSE_COUNT = '''
33+
genericDevicePlugin:
34+
status: Enabled
35+
devices:
36+
- name: fuse
37+
groups:
38+
- count: 10
39+
paths:
40+
- path: /dev/fuse
41+
'''
42+
43+
POD_FUSE_DEVICE = '''
44+
apiVersion: v1
45+
kind: Pod
46+
metadata:
47+
name: fuse-test-pod
48+
spec:
49+
containers:
50+
- name: fuse-app-container
51+
image: registry.access.redhat.com/ubi9/ubi:9.6
52+
command: ["sleep", "infinity"]
53+
resources:
54+
limits:
55+
device.microshift.io/fuse: "4"
56+
securityContext:
57+
allowPrivilegeEscalation: false
58+
capabilities:
59+
drop: ["ALL"]
60+
runAsNonRoot: true
61+
seccompProfile:
62+
type: "RuntimeDefault"
63+
'''
64+
3265
CONFIGMAP_PREAMBLE = '''
3366
apiVersion: v1
3467
kind: ConfigMap

0 commit comments

Comments
 (0)