Files
kubevirt.core/tests/integration/targets/kubevirt_vm/verify.yml
Felix Matouschek 2521e8ba24 fix(tests,kubevirt_vm): Assert there are no or expected changes
Assert there are no or expected changes in verify.yml of the kubevirt_vm
integration test. This is necessary since in downstream tests the
kubemacpool operator might add annotations to the VM which can trigger a
changed result.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-06-04 09:53:53 +02:00

51 lines
1.2 KiB
YAML

---
- name: Verify creation with existing VM
connection: local
gather_facts: false
hosts: localhost
tasks:
- name: Create a VM
kubevirt.core.kubevirt_vm:
name: testvm
namespace: default
labels:
app: test
register: recreate
- name: Assert module reported no or expected changes
ansible.builtin.assert:
that:
- >-
not recreate.changed or
recreated.changed and
recreated.method == "update" and
recreated.diff.before.metadata.annotations.get('kubemacpool.io/transaction-timestamp') and
not recreated.diff.after.metadata.annotations
- name: Delete VM
connection: local
gather_facts: false
hosts: localhost
tasks:
- name: Delete a VM
kubevirt.core.kubevirt_vm:
name: testvm
namespace: default
state: absent
wait: true
- name: Verify VM deletion
connection: local
gather_facts: false
hosts: localhost
tasks:
- name: Delete a VM
kubevirt.core.kubevirt_vm:
name: testvm
namespace: default
state: absent
register: delete
- name: Assert module reported no changes
ansible.builtin.assert:
that:
- not delete.changed