Files
Felix Matouschek 71ea312cfc kubevirt_vm: Run integration test in random namespace
Run the integration tests for kubevirt_vm in a random namespace
and cleanup after the tests finish.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-08-16 08:37:36 +02:00

51 lines
1.3 KiB
Django/Jinja

---
- 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: {{ NAMESPACE }}
labels:
app: test
register: recreate
- name: Assert module reported no or expected changes
ansible.builtin.assert:
that:
- >-
not recreate.changed or
recreate.changed and
recreate.method == "update" and
recreate.diff.before.metadata.annotations.get('kubemacpool.io/transaction-timestamp') and
not recreate.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: {{ NAMESPACE }}
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: {{ NAMESPACE }}
state: absent
register: delete
- name: Assert module reported no changes
ansible.builtin.assert:
that:
- not delete.changed