Skip to content

Commit 653c5cf

Browse files
committed
feat(evals): add update-vm-instancetype eval task
Add a new kubevirt eval that tests doubling VM memory by changing instance types. Includes a verify_instancetype_changed helper function. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
1 parent c237306 commit 653c5cf

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

  • evals/tasks/kubevirt/update-vm-instancetype
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
kind: Task
2+
apiVersion: mcpchecker/v1alpha2
3+
metadata:
4+
name: "update-vm-instancetype"
5+
labels:
6+
suite: kubevirt
7+
requires: kubevirt
8+
difficulty: hard
9+
spec:
10+
requires:
11+
- extension: kubernetes
12+
as: k8s
13+
setup:
14+
- k8s.delete:
15+
apiVersion: v1
16+
kind: Namespace
17+
metadata:
18+
name: vm-test
19+
ignoreNotFound: true
20+
- k8s.create:
21+
apiVersion: v1
22+
kind: Namespace
23+
metadata:
24+
name: vm-test
25+
- k8s.create:
26+
apiVersion: kubevirt.io/v1
27+
kind: VirtualMachine
28+
metadata:
29+
name: fedora-vm
30+
namespace: vm-test
31+
spec:
32+
runStrategy: Halted
33+
instancetype:
34+
name: u1.small
35+
kind: VirtualMachineClusterInstancetype
36+
template:
37+
spec:
38+
domain:
39+
devices:
40+
disks:
41+
- name: containerdisk
42+
disk:
43+
bus: virtio
44+
volumes:
45+
- name: containerdisk
46+
containerDisk:
47+
image: quay.io/containerdisks/fedora:latest
48+
verify:
49+
- script:
50+
inline: |-
51+
#!/usr/bin/env bash
52+
set -e
53+
NS="vm-test"
54+
VM_NAME="fedora-vm"
55+
56+
# Verify VM still exists
57+
kubectl get virtualmachine "$VM_NAME" -n "$NS" > /dev/null
58+
echo "VirtualMachine $VM_NAME exists"
59+
60+
# Verify VM uses the expected u1.medium instancetype
61+
INSTANCETYPE=$(kubectl get virtualmachine "$VM_NAME" -n "$NS" -o jsonpath='{.spec.instancetype.name}')
62+
if [ "$INSTANCETYPE" != "u1.medium" ]; then
63+
echo "ERROR: Expected instancetype 'u1.medium', found: '$INSTANCETYPE'"
64+
exit 1
65+
fi
66+
echo "Instancetype is u1.medium"
67+
68+
# Verify no direct resource specification
69+
GUEST_MEMORY=$(kubectl get virtualmachine "$VM_NAME" -n "$NS" -o jsonpath='{.spec.template.spec.domain.memory.guest}')
70+
if [ -n "$GUEST_MEMORY" ]; then
71+
echo "WARNING: VirtualMachine has direct memory specification: $GUEST_MEMORY"
72+
else
73+
echo "VirtualMachine uses instancetype for resources (no direct memory spec)"
74+
fi
75+
76+
echo "All validations passed"
77+
exit 0
78+
cleanup:
79+
- k8s.delete:
80+
apiVersion: kubevirt.io/v1
81+
kind: VirtualMachine
82+
metadata:
83+
name: fedora-vm
84+
namespace: vm-test
85+
ignoreNotFound: true
86+
- k8s.delete:
87+
apiVersion: v1
88+
kind: Namespace
89+
metadata:
90+
name: vm-test
91+
ignoreNotFound: true
92+
prompt:
93+
inline: |
94+
A Fedora VirtualMachine named fedora-vm exists in the vm-test namespace using the u1.small instancetype. Double its memory by updating the instance type.

0 commit comments

Comments
 (0)