Skip to content

Commit ebdb11e

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

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: fuse-test-pod
5+
spec:
6+
containers:
7+
- name: fuse-app-container
8+
image: registry.access.redhat.com/ubi9/ubi:9.6
9+
command: ["sleep", "infinity"]
10+
resources:
11+
limits:
12+
device.microshift.io/fuse: "4"
13+
securityContext:
14+
allowPrivilegeEscalation: false
15+
capabilities:
16+
drop: ["ALL"]
17+
runAsNonRoot: true
18+
seccompProfile:
19+
type: "RuntimeDefault"

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,34 @@ 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+
[Setup] 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+
VAR ${path}= ./assets/generic-device-plugin/fuse-test-pod.yaml
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}= Oc Exec 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+
${allocated_line}= Get Lines Containing String ${describe_output} device.microshift.io/fuse
73+
${allocation_matches}= Get Regexp Matches
74+
... ${allocated_line}
75+
... device\\.microshift\\.io/fuse\\s+(\\d+)\\s+(\\d+)
76+
... 1 2
77+
Should Be Equal As Integers ${allocation_matches}[0] 4
78+
Should Be Equal As Integers ${allocation_matches}[1] 4
79+
5280

5381
*** Keywords ***
5482
GDP Test Setup
@@ -132,20 +160,20 @@ Create Test Job With Modified Script
132160

133161
Wait Until Device Is Allocatable
134162
[Documentation] Waits until device device.microshift.io/fakeserial is allocatable
135-
[Arguments] ${expected_count}=1
163+
[Arguments] ${expected_count}=1 ${device_type}=fakeserial
136164
${node}= Run With Kubeconfig oc get node -o=name
137165
${node_name}= Remove String ${node} node/
138166
Wait Until Keyword Succeeds 60s 5s
139-
... Device Should Be Allocatable ${node_name} ${expected_count}
167+
... Device Should Be Allocatable ${node_name} ${expected_count} ${device_type}
140168

141169
Device Should Be Allocatable
142-
[Documentation] Checks if device device.microshift.io/fakeserial is allocatable
143-
[Arguments] ${node_name} ${expected_count}=1
170+
[Documentation] Checks if specified device is allocatable
171+
[Arguments] ${node_name} ${expected_count}=1 ${device_type}=fakeserial
144172
${device_amount}= Oc Get JsonPath
145173
... node
146174
... ${EMPTY}
147175
... ${node_name}
148-
... .status.allocatable.device\\.microshift\\.io/fakeserial
176+
... .status.allocatable.device\\.microshift\\.io/${device_type}
149177
Should Be Equal As Integers ${device_amount} ${expected_count}
150178

151179
Wait For Job Completion And Check Logs

test/suites/optional/strings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
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+
3244
CONFIGMAP_PREAMBLE = '''
3345
apiVersion: v1
3446
kind: ConfigMap

0 commit comments

Comments
 (0)