Skip to content

Commit cf06c60

Browse files
sradcoAI Assistantcursoragent
committed
eval(kubevirt): add vm_troubleshoot tool evals for
missing StorageClass and cloud-init crashloop Adds two eval tasks that exercise the vm_troubleshoot tool's heuristic issue detection: 1. troubleshoot-vm-missing-storageclass: Creates a VM referencing a non-existent StorageClass. Verifies the agent calls vm_troubleshoot and reports the CRITICAL missing SC finding with alternatives. 2. troubleshoot-vm-cloudinit-shutdown: Creates a VM with "shutdown -h now" in cloud-init runcmd that causes CrashLoopBackOff. Verifies the agent identifies the dangerous command as root cause. Both scenarios are deterministic and non-flaky on any cluster with KubeVirt installed. Signed-off-by: Shirly Radco <sradco@redhat.com> Co-authored-by: AI Assistant <noreply@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5b042f3 commit cf06c60

2 files changed

Lines changed: 205 additions & 0 deletions

File tree

  • evals/tasks/kubevirt
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
kind: Task
2+
apiVersion: mcpchecker/v1alpha2
3+
metadata:
4+
labels:
5+
suite: kubevirt
6+
requires: kubevirt
7+
name: "troubleshoot-vm-cloudinit-shutdown"
8+
difficulty: medium
9+
description: "Use the vm_troubleshoot tool to diagnose a VM crashlooping due to a shutdown command in cloud-init"
10+
spec:
11+
requires:
12+
- extension: kubernetes
13+
as: k8s
14+
setup:
15+
- k8s.delete:
16+
apiVersion: v1
17+
kind: Namespace
18+
metadata:
19+
name: vm-test-troubleshoot-ci
20+
ignoreNotFound: true
21+
- k8s.create:
22+
apiVersion: v1
23+
kind: Namespace
24+
metadata:
25+
name: vm-test-troubleshoot-ci
26+
- k8s.create:
27+
apiVersion: kubevirt.io/v1
28+
kind: VirtualMachine
29+
metadata:
30+
name: crashloop-vm
31+
namespace: vm-test-troubleshoot-ci
32+
spec:
33+
runStrategy: Always
34+
template:
35+
spec:
36+
domain:
37+
devices:
38+
disks:
39+
- name: containerdisk
40+
disk:
41+
bus: virtio
42+
- name: cloudinit
43+
disk:
44+
bus: virtio
45+
resources:
46+
requests:
47+
memory: 2Gi
48+
terminationGracePeriodSeconds: 0
49+
volumes:
50+
- name: containerdisk
51+
containerDisk:
52+
image: quay.io/containerdisks/fedora:latest
53+
- name: cloudinit
54+
cloudInitNoCloud:
55+
userData: |
56+
#cloud-config
57+
runcmd:
58+
- shutdown -h now
59+
- script:
60+
inline: |-
61+
#!/usr/bin/env bash
62+
echo "Waiting for VM to enter CrashLoopBackOff state..."
63+
sleep 90
64+
verify:
65+
- script:
66+
inline: |-
67+
#!/usr/bin/env bash
68+
NS="vm-test-troubleshoot-ci"
69+
70+
echo "=== Verification: Agent used vm_troubleshoot and identified cloud-init issue ==="
71+
72+
if ! kubectl get virtualmachine crashloop-vm -n "$NS" > /dev/null 2>&1; then
73+
echo "✗ VirtualMachine crashloop-vm no longer exists"
74+
exit 1
75+
fi
76+
echo "✓ VirtualMachine crashloop-vm still exists"
77+
exit 0
78+
- llmJudge:
79+
contains: "shutdown"
80+
cleanup:
81+
- k8s.delete:
82+
apiVersion: kubevirt.io/v1
83+
kind: VirtualMachine
84+
metadata:
85+
name: crashloop-vm
86+
namespace: vm-test-troubleshoot-ci
87+
ignoreNotFound: true
88+
- k8s.delete:
89+
apiVersion: v1
90+
kind: Namespace
91+
metadata:
92+
name: vm-test-troubleshoot-ci
93+
ignoreNotFound: true
94+
prompt:
95+
inline: |-
96+
A VirtualMachine named "crashloop-vm" in the vm-test-troubleshoot-ci namespace keeps restarting.
97+
Use the vm_troubleshoot tool to diagnose why this VM is crashlooping. Report:
98+
- The root cause of the crashloop
99+
- Which cloud-init command is causing the problem
100+
- How to fix it
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
kind: Task
2+
apiVersion: mcpchecker/v1alpha2
3+
metadata:
4+
labels:
5+
suite: kubevirt
6+
requires: kubevirt
7+
name: "troubleshoot-vm-missing-storageclass"
8+
difficulty: medium
9+
description: "Use the vm_troubleshoot tool to diagnose a VM stuck in Provisioning due to a non-existent StorageClass"
10+
spec:
11+
requires:
12+
- extension: kubernetes
13+
as: k8s
14+
setup:
15+
- k8s.delete:
16+
apiVersion: v1
17+
kind: Namespace
18+
metadata:
19+
name: vm-test-troubleshoot-sc
20+
ignoreNotFound: true
21+
- k8s.create:
22+
apiVersion: v1
23+
kind: Namespace
24+
metadata:
25+
name: vm-test-troubleshoot-sc
26+
- k8s.create:
27+
apiVersion: kubevirt.io/v1
28+
kind: VirtualMachine
29+
metadata:
30+
name: broken-sc-vm
31+
namespace: vm-test-troubleshoot-sc
32+
spec:
33+
runStrategy: Always
34+
dataVolumeTemplates:
35+
- metadata:
36+
name: broken-sc-vm-rootdisk
37+
spec:
38+
storage:
39+
storageClassName: non-existent-sc-xyz
40+
accessModes:
41+
- ReadWriteOnce
42+
resources:
43+
requests:
44+
storage: 10Gi
45+
source:
46+
registry:
47+
url: docker://quay.io/containerdisks/fedora:latest
48+
template:
49+
spec:
50+
domain:
51+
devices:
52+
disks:
53+
- name: rootdisk
54+
disk:
55+
bus: virtio
56+
resources:
57+
requests:
58+
memory: 2Gi
59+
terminationGracePeriodSeconds: 0
60+
volumes:
61+
- name: rootdisk
62+
dataVolume:
63+
name: broken-sc-vm-rootdisk
64+
- script:
65+
inline: |-
66+
#!/usr/bin/env bash
67+
echo "Waiting for VM to enter Provisioning state..."
68+
sleep 15
69+
verify:
70+
- script:
71+
inline: |-
72+
#!/usr/bin/env bash
73+
NS="vm-test-troubleshoot-sc"
74+
75+
echo "=== Verification: Agent used vm_troubleshoot and identified missing StorageClass ==="
76+
77+
if ! kubectl get virtualmachine broken-sc-vm -n "$NS" > /dev/null 2>&1; then
78+
echo "✗ VirtualMachine broken-sc-vm no longer exists"
79+
exit 1
80+
fi
81+
echo "✓ VirtualMachine broken-sc-vm still exists"
82+
exit 0
83+
- llmJudge:
84+
contains: "non-existent-sc-xyz"
85+
cleanup:
86+
- k8s.delete:
87+
apiVersion: kubevirt.io/v1
88+
kind: VirtualMachine
89+
metadata:
90+
name: broken-sc-vm
91+
namespace: vm-test-troubleshoot-sc
92+
ignoreNotFound: true
93+
- k8s.delete:
94+
apiVersion: v1
95+
kind: Namespace
96+
metadata:
97+
name: vm-test-troubleshoot-sc
98+
ignoreNotFound: true
99+
prompt:
100+
inline: |-
101+
A VirtualMachine named "broken-sc-vm" in the vm-test-troubleshoot-sc namespace is not starting.
102+
Use the vm_troubleshoot tool to diagnose why this VM is stuck. Report:
103+
- The root cause of the issue
104+
- What StorageClass is missing
105+
- What alternative StorageClasses are available on the cluster

0 commit comments

Comments
 (0)