@@ -8,7 +8,7 @@ Variables strings.py
8
8
Library strings.py
9
9
10
10
Suite Setup Setup Suite With Namespace
11
- Suite Teardown Teardown Suite With Namespace
11
+ Suite Teardown Teardown Suite With GDP Cleanup
12
12
13
13
Test Tags generic-device-plugin
14
14
@@ -20,35 +20,50 @@ ${NAMESPACE} ${EMPTY}
20
20
*** Test Cases ***
21
21
Sanity Test
22
22
[Documentation] Performs a simple test of Generic Device Plugin
23
- [Setup] Run Keywords
24
- ... Enable And Configure GDP
25
- ... Enable Serialsim
26
- ... Copy Script To Host
23
+ [Setup] GDP Test Setup ${GDP_CONFIG_DROPIN }
27
24
28
- Wait Until Device Is Allocatable
29
-
30
- Command Should Work crictl pull registry.access.redhat.com/ubi9/ubi:9.6
31
- Start Script On Host
32
25
Create Test Job
26
+ Wait For Job Completion And Check Logs
27
+
28
+ [Teardown] GDP Test Teardown
29
+
30
+ Verify that mountPath correctly renames the device within the container
31
+ [Documentation] Performs a test of Generic Device Plugin with custom mountPath configuration
32
+ [Setup] GDP Test Setup ${GDP_CONFIG_DROPIN_WITH_MOUNT }
33
33
34
+ Create Test Job With Modified Script
34
35
Wait For Job Completion And Check Logs
35
36
36
- [Teardown] Run Keywords
37
- ... Stop Script On Host
38
- ... Disable GDP
37
+ [Teardown] GDP Test Teardown
39
38
40
39
41
40
*** Keywords ***
41
+ GDP Test Setup
42
+ [Documentation] Common setup for GDP tests - configures GDP, enables serialsim, prepares environment
43
+ [Arguments] ${config_content }
44
+ Enable And Configure GDP ${config_content }
45
+ Enable Serialsim
46
+ Copy Script To Host
47
+ Wait Until Device Is Allocatable
48
+ Command Should Work crictl pull registry.access.redhat.com/ubi9/ubi:9.6
49
+ Start Script On Host
50
+
51
+ GDP Test Teardown
52
+ [Documentation] Common teardown for GDP tests - stops script, cleans up resources, disables GDP
53
+ Stop Script On Host
54
+ Cleanup Test Resources
55
+ Disable GDP
56
+
42
57
Enable And Configure GDP
43
58
[Documentation] Enables GDP and adds fake device path in MicroShift configuration
44
- Drop In MicroShift Config ${GDP_CONFIG_DROPIN } 10 -gdp
59
+ [Arguments] ${config_content } =${GDP_CONFIG_DROPIN } ${dropin_name } =10 -gdp
60
+ Drop In MicroShift Config ${config_content } ${dropin_name }
45
61
Restart MicroShift
46
62
47
63
Disable GDP
48
- [Documentation] Removes GDP configuration drop-in
49
- Remove Drop In MicroShift Config 10-gdp
50
- Restart MicroShift
51
- Restart Greenboot And Wait For Success
64
+ [Documentation] Removes GDP configuration drop-in (without restart)
65
+ [Arguments] ${dropin_name } =10 -gdp
66
+ Remove Drop In MicroShift Config ${dropin_name }
52
67
53
68
Enable Serialsim
54
69
[Documentation] Enables the serialsim kernel module.
@@ -75,6 +90,13 @@ Stop Script On Host
75
90
Command Execution systemctl stop gdp-test-comm
76
91
Command Execution systemctl reset-failed gdp-test-comm
77
92
93
+ Cleanup Test Resources
94
+ [Documentation] Cleans up test resources including configmap and job
95
+ Run Keyword And Ignore Error
96
+ ... Oc Delete job/gdp-test -n ${NAMESPACE }
97
+ Run Keyword And Ignore Error
98
+ ... Oc Delete configmap/gdp-script -n ${NAMESPACE }
99
+
78
100
Create Test Job
79
101
[Documentation] Creates Job that spawns test Pod running to completion.
80
102
${script } = OperatingSystem.Get File ./assets/generic-device-plugin/fake-serial-communication.py
@@ -84,11 +106,23 @@ Create Test Job
84
106
Oc Create -f ${path } -n ${NAMESPACE }
85
107
Oc Create -f ./assets/generic-device-plugin/job.yaml -n ${NAMESPACE }
86
108
109
+ Create Test Job With Modified Script
110
+ [Documentation] Creates Job that spawns test Pod running to completion with modified script.
111
+ ${script } = OperatingSystem.Get File ./assets/generic-device-plugin/fake-serial-communication.py
112
+ ${modified_script } = Replace String
113
+ ... ${script }
114
+ ... DEVICE_POD = "/dev/ttyPipeB0"
115
+ ... DEVICE_POD = "/dev/myrenamedserial"
116
+ ${configmap } = Append To Preamble ${modified_script }
117
+ Log ${configmap }
118
+ ${path } = Create Random Temp File ${configmap }
119
+ Oc Create -f ${path } -n ${NAMESPACE }
120
+ Oc Create -f ./assets/generic-device-plugin/job.yaml -n ${NAMESPACE }
121
+
87
122
Wait Until Device Is Allocatable
88
123
[Documentation] Waits until device device.microshift.io/fakeserial is allocatable
89
124
${node } = Run With Kubeconfig oc get node -o=name
90
125
${node_name } = Remove String ${node } node/
91
-
92
126
Wait Until Keyword Succeeds 60s 5s
93
127
... Device Should Be Allocatable ${node_name }
94
128
@@ -113,3 +147,14 @@ Wait For Job Completion And Check Logs
113
147
... .items[*].metadata.name
114
148
${logs } = Oc Logs ${pod } ${NAMESPACE }
115
149
Should Contain ${logs } Test successful
150
+
151
+ Teardown Suite With GDP Cleanup
152
+ [Documentation] Suite teardown that cleans up GDP configuration and restarts MicroShift
153
+ # Clean up any remaining GDP configuration
154
+ Run Keyword And Ignore Error
155
+ ... Remove Drop In MicroShift Config 10-gdp
156
+ # Restart MicroShift to clean state for next suite
157
+ Restart MicroShift
158
+ Restart Greenboot And Wait For Success
159
+ # Call original suite teardown
160
+ Teardown Suite With Namespace
0 commit comments