mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-05-06 05:12:37 +00:00
ci: Cleanup inventory_kubevirt integration test
- Use uniform way of naming plays, tasks and VMs - Use uniform way of ordering task parameters - Use defaults where possible - Use CentOS Stream 9 as VM OS - Drop unneeded environment variables - Use FQCN of Ansible modules - Add missing test for empty inventory - Add .gitignore for test files Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
4
tests/integration/targets/inventory_kubevirt/.gitignore
vendored
Normal file
4
tests/integration/targets/inventory_kubevirt/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
all.yml
|
||||
empty.yml
|
||||
label.yml
|
||||
net.yml
|
||||
@@ -1,22 +1,18 @@
|
||||
---
|
||||
- name: Create VM
|
||||
- name: Create VMs
|
||||
connection: local
|
||||
gather_facts: false
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: Create a VirtualMachine
|
||||
- name: Create a VM
|
||||
kubevirt.core.kubevirt_vm:
|
||||
state: present
|
||||
name: testvm
|
||||
name: testvm1
|
||||
namespace: default
|
||||
labels:
|
||||
app: test
|
||||
wait: true
|
||||
wait_timeout: 600
|
||||
spec:
|
||||
domain:
|
||||
cpu:
|
||||
sockets: 1
|
||||
memory:
|
||||
guest: 256Mi
|
||||
devices:
|
||||
@@ -33,31 +29,26 @@
|
||||
networkName: kindexgw
|
||||
volumes:
|
||||
- containerDisk:
|
||||
image: quay.io/containerdisks/fedora:latest
|
||||
image: quay.io/containerdisks/centos-stream:9
|
||||
name: containerdisk
|
||||
- name: Create a 2nd VirtualMachine
|
||||
wait: true
|
||||
wait_timeout: 600
|
||||
|
||||
- name: Create another VM
|
||||
kubevirt.core.kubevirt_vm:
|
||||
state: present
|
||||
name: testvm2
|
||||
namespace: default
|
||||
labels:
|
||||
foo: bar
|
||||
wait: true
|
||||
wait_timeout: 600
|
||||
spec:
|
||||
domain:
|
||||
cpu:
|
||||
sockets: 1
|
||||
memory:
|
||||
guest: 256Mi
|
||||
devices:
|
||||
interfaces:
|
||||
- name: default
|
||||
masquerade: {}
|
||||
networks:
|
||||
- name: default
|
||||
pod: {}
|
||||
devices: {}
|
||||
volumes:
|
||||
- containerDisk:
|
||||
image: quay.io/containerdisks/fedora:latest
|
||||
image: quay.io/containerdisks/centos-stream:9
|
||||
name: containerdisk
|
||||
wait: true
|
||||
wait_timeout: 600
|
||||
|
||||
@@ -2,14 +2,8 @@
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
export ANSIBLE_ROLES_PATH="../"
|
||||
|
||||
USER_CREDENTIALS_DIR=$(pwd)
|
||||
export USER_CREDENTIALS_DIR
|
||||
|
||||
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||
export ANSIBLE_INVENTORY_ENABLED=kubevirt.core.kubevirt,yaml
|
||||
export ANSIBLE_PYTHON_INTERPRETER=auto_silent
|
||||
export ANSIBLE_CALLBACKS_ENABLED=ansible.posix.profile_tasks
|
||||
export ANSIBLE_INVENTORY_ENABLED=kubevirt.core.kubevirt
|
||||
|
||||
ansible-inventory -i test.kubevirt.yml -y --list --output empty.yml "$@"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
plugin: kubevirt.core.kubevirt
|
||||
connections:
|
||||
- namespaces:
|
||||
- name: test
|
||||
namespaces:
|
||||
- default
|
||||
create_groups: true
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
ansible.builtin.include_vars:
|
||||
file: empty.yml
|
||||
name: inv_empty
|
||||
- name: Read inventory after vm creation
|
||||
- name: Assert empty inventory
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- inv_empty['all'] is not defined or inv_empty['all']['children']['test']['children']['namespace_default']['hosts'] is not defined
|
||||
- name: Read inventory after VM creation
|
||||
ansible.builtin.include_vars:
|
||||
file: all.yml
|
||||
name: inv_all
|
||||
|
||||
Reference in New Issue
Block a user