It refactors fixtures: `add_group` and `add_host` to improve fixtures
reusability in further scenarios.
Signed-off-by: Javier Cano Cano <jcanocan@redhat.com>
Change the license of the collection to Apache 2.0 to be compliant with
the CNCF licensing requirements.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Fix the assertion that was introduced in
2521e8ba24 by removing the superfluous 'd'
at the end of the variable names.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
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>
This changes the runme.sh of the kubevirt_vm integration tests to retry
the connection to the VM until a login is possible. This is necessary
since it is not possible with Ansible alone to retry a task in case the
connection failed with the unreachable status. This can happen when the
sshd of the VM already accepts connections but a login is not yet
possible because the VM is still booting up.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
It adds unit tests for the render_template function. These test cases
cover all cases for non-mandatory fields in the VM template.
Signed-off-by: Javier Cano Cano <jcanocan@redhat.com>
Add the running parameter to kubevirt_vm_info from which the
wait_condition is derived from when parameter wait is set to
yes.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Adds a test to assert deletion options are the expected.
Refactors python fixtures to reuse common fields in both create and
delete tests.
Signed-off-by: Javier Cano Cano <jcanocan@redhat.com>
To properly wait for a state change in the kubevirt_vm module the
wait_condition needs to adapted to the state of running.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Cleanup the YAML passed to the k8s module so it conforms to yaml output
you would expect from yaml.dump. Also refactor the tests to get rid of
duplicate definitions and make use of pytest.mark.parametrize and
yaml.dump.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Adds unit test to assert VM label and field selectors work as expected.
Refactors python fixtures to reuse defaults and avoid code duplication.
Signed-off-by: Javier Cano Cano <jcanocan@redhat.com>
This changes the inventory plugin so that it sets the ansible_connection
to winrm if it detected a Windows host. If it did not detect a Windows
host the ansible_connection is no longer set, so Ansible falls back to
its default value of ssh. The detection of SSH services for hosts using
winrm is disabled.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Add a test file for the inventory plugin with some basic unit tests.
This file can be used to add more tests in the future.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Reorganize unit tests so the directory structure looks like the
structure used in most other collections.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Cleanup the existing unit tests and move them to pytest. By using pytest
it becomes easier to add new tests for existing functionality in the
collection.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Add tox configuration that allows to build a venv for development and to
format source files. To make use of it add appropriate Makefile targets.
Drop unneeded requirements from requirements.txt and
test-requirements.txt and add needed requirements.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Rework gitignore by combining all gitignore files and adding files
generated by running tests.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Cleanup the created the created VMs after the inventory integration
tests collected the inventory test results to not leave running VMs
behind after the test finished.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
- Use uniform way of naming plays, tasks and VMs
- Use uniform way of ordering task parameters
- Use defaults where possible
- Use CentOS 9 Stream instancetype and preference
- Generate SSH private key with empty password (-N "")
- Disable strict host key checking
- Add .gitignore for test files
- Fix skipping test key creation if already existent
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
- 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>
Remove { } from runme.sh files to avoid failures being masked.
Re-add install of ansible.posix to have the
ansible.posix.profile_task callback available.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Update the requirements throughout the project to be in sync and to
reflect the current state of dependencies.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This adds yamllint to the CI linter job and sets the maximum line
length to 140 like in kubevirt/kubevirt.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Bump the software versions defined in hack/e2e-setup.sh to the latest
ones and sync version installed of kind in github integration tests
with e2e-setup.sh. Update the CentOS 9 Stream preference name used in
the tests to the new name in common-instancetypes v0.4.0.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This adds the kubevirt_vm_info module, which returns the same results as
the kubevirt_vm module, but is limited to read-only functionality.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This adds the create_groups option to the inventory, which allows to
control the creation of groups from labels on VirtualMachines. By
default it is disabled.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This removes the unnecessary whitespace from the rendered VirtualMachine
template and adds a unit test for it.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>