Commit 24ad072
committed
feat(kubevirt): Add enforcement and validation for runStrategy over deprecated running field
Strengthen the VM creation guidance and add explicit test assertions to ensure
the deprecated 'running' field is not used in VirtualMachine specs.
Changes to VM Creation Template (plan.tmpl):
- Add prominent warning section about deprecated 'running' field
- Include side-by-side comparison showing incorrect vs. correct usage
- Clear visual indicators (❌ INCORRECT vs. ✅ CORRECT)
- Emphasize that 'runStrategy' must be used instead
Changes to Test Helper Functions (verify-vm.sh):
- Add new `verify_no_deprecated_running_field()` function
- Explicitly checks that spec.running is not set
- Returns failure if deprecated field is found
- Provides clear error message directing users to use runStrategy
Changes to Test Tasks (all 5 VM creation tests):
- Add assertion in all test tasks to verify running field is not used
- Tests now explicitly call `verify_no_deprecated_running_field()`
- Ensures compliance with KubeVirt best practices
- Tests fail if VMs are created with deprecated field
Benefits:
- Prevents use of deprecated KubeVirt API fields
- Explicit test coverage for API field deprecation
- Clear guidance for AI assistants creating VMs
- Ensures forward compatibility with future KubeVirt versions
- Enforces best practices through automated testing
Assisted-By: Claude <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>1 parent ef8192d commit 24ad072
File tree
8 files changed
+64
-7
lines changed- pkg/toolsets/kubevirt/vm
- create
- tests
- helpers
- tasks
- create-vm-basic
- create-vm-ubuntu
- create-vm-with-instancetype
- create-vm-with-performance
- create-vm-with-size
8 files changed
+64
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
4 | 20 | | |
5 | 21 | | |
6 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
62 | 77 | | |
63 | 78 | | |
64 | 79 | | |
| |||
158 | 173 | | |
159 | 174 | | |
160 | 175 | | |
161 | | - | |
| 176 | + | |
162 | 177 | | |
| 178 | + | |
163 | 179 | | |
164 | 180 | | |
165 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
66 | 86 | | |
67 | 87 | | |
68 | 88 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments