93 Commits

Author SHA1 Message Date
Felix Matouschek
9d24aa878d cleanup: Run formatter on test_kubevirt_vm.py
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-04-24 18:38:51 +02:00
Javier Cano Cano
44936096ce test: add kubevirt_vm delete test case
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>
2024-04-24 15:57:32 +02:00
Felix Matouschek
86cee0172f fix(kubevirt_vm): Set wait_condition based on running
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>
2024-04-24 14:53:41 +02:00
Felix Matouschek
e5edf072cc cleanup: Cleanup YAML passed to k8s module
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>
2024-04-24 12:16:10 +02:00
Javier Cano Cano
3814d1deb5 test: add kubevirt_vm test cases
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>
2024-04-18 17:01:30 +02:00
Felix Matouschek
ee7f99267c chore: Add requirements.txt for ansible-test units
Add the requirements.txt with requirements needed by ansible-test units.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-04-16 18:17:37 +02:00
Felix Matouschek
a3abcbedd4 feat: Set ansible_connection to winrm for Windows hosts
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>
2024-04-16 16:38:54 +02:00
Felix Matouschek
7c5de4adf9 cleanup: Run make format
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-04-16 16:38:54 +02:00
Felix Matouschek
5ae19f9623 tests: Add basic unit tests for inventory plugin
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>
2024-04-16 15:16:37 +02:00
Felix Matouschek
1947fe9ca8 cleanup: Reorganize unit tests
Reorganize unit tests so the directory structure looks like the
structure used in most other collections.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-04-15 13:58:08 +02:00
Felix Matouschek
9848f66036 cleanup: Migrate existing unit tests to pytest
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>
2024-04-15 13:58:08 +02:00
Felix Matouschek
e2d2da2670 chore: Add tox configuration
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>
2024-04-12 10:23:38 +02:00
Felix Matouschek
1772f182e0 chore: Rework gitignore
Rework gitignore by combining all gitignore files and adding files
generated by running tests.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-03-20 10:19:13 +01:00
Felix Matouschek
651e1d6718 fix: Rename tests/config.yaml to tests/config.yml
The file extension of the file needs to be .yml, so ansible-test is able
to pick it up.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-03-20 09:19:28 +01:00
Felix Matouschek
41751fe432 chore: Fix names in inventory cleanup
We are deleting VMs, not creating VMs. Therefore change the names to
reflect that.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-03-18 17:21:52 +01:00
Felix Matouschek
eb2291692d tests: Cleanup after inventory test
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>
2024-03-18 17:00:53 +01:00
Felix Matouschek
926989e7ef cleanup: Remove unneeded inventory file
Remove unneeded tests/integration/inventory file, which likely got added
by accident.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-03-11 13:13:43 +01:00
Felix Matouschek
62007c326a ci: Cleanup kubevirt_vm_info integration test
- Use uniform way of naming plays, tasks and VMs
- Use defaults where possible

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-03-04 14:02:08 +01:00
Felix Matouschek
ed642885ab ci: Cleanup kubevirt_vm integration test
- 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>
2024-03-04 14:02:08 +01:00
Felix Matouschek
b928cb5b29 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>
2024-03-04 14:02:03 +01:00
Felix Matouschek
5e2f152c7d ci: Fix failing integration tests
The default name of the default user in centos.stream9 is cloud-user.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-03-01 16:01:51 +01:00
Felix Matouschek
9e2fc74ccb ci: Fix non failing integration tests
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>
2024-03-01 14:50:33 +01:00
kubevirt-bot
29516d3bfd Merge pull request #45 from 0xFelix/misc-cleanups
Misc cleanups
2024-02-29 15:58:57 +01:00
Felix Matouschek
69f7699c08 chore: Remove unneeded sanity test ignore files
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-02-29 14:06:31 +01:00
Felix Matouschek
49638c31b5 chore: Run black formatter on project files
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-02-29 14:06:16 +01:00
Felix Matouschek
44e1c0a719 cleanup: Update requirements throughout the project
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>
2024-02-29 14:03:19 +01:00
kubevirt-bot
4429ac8c03 Merge pull request #39 from 0xFelix/bump-version-e2e
Bump e2e-setup.sh version and ensure compatibility with KubeVirt >=1.1.0
2024-02-29 13:08:57 +01:00
Felix Matouschek
77ece9d466 ci: Add yamllint to CI linter job
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>
2024-02-29 11:41:49 +01:00
Felix Matouschek
fa9183c21a hack: Bump e2e-setup.sh version
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>
2024-02-29 09:47:50 +01:00
Felix Matouschek
74f4a48ac1 Pin python version
Pin the supported python version in tests/config.yaml and mention it in
README.md.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-02-26 17:04:19 +01:00
Felix Matouschek
bb132b1682 Move test .kubeconfig into CI setup
Inline the creation of a test .kubeconfig into the CI setup.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-02-26 16:59:03 +01:00
Felix Matouschek
6ee5a9c7c9 ansible-lint: Groom the .ansible-lint file
- Enable production profile
- Remove excludes no longer necessary
- Try to not skip any tests

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2024-02-26 16:31:56 +01:00
kubevirt-bot
d1318db8db Merge pull request #24 from 0xFelix/info_module
kubevirt_vm_info: Add info module for VirtualMachines
2023-09-07 15:57:28 +02:00
Felix Matouschek
6486766b11 kubevirt_vm_info: Add info module for VirtualMachines
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>
2023-09-06 13:04:07 +02:00
Felix Matouschek
e33b479326 inventory: Add create_groups option
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>
2023-09-05 15:56:46 +02:00
Guido Grazioli
198d885b8f ci: integration tests
Signed-off-by: Guido Grazioli <ggraziol@redhat.com>
2023-08-04 15:27:41 +02:00
Felix Matouschek
38c76a9545 Rename collection to kubevirt.core
This replaces all occurences of the old kubernetes.core name.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2023-08-03 13:03:10 +02:00
Felix Matouschek
0875abc080 kubevirt_vm: Prevent unnecessary whitespace
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>
2023-07-18 16:08:01 +02:00
Felix Matouschek
bce4f17188 kubevirt_vm: Allow to specify DataVolume templates
By allowing to specify DataVolume templates VMs with persistent storage
can be created using the kubevirt_vm module.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2023-07-18 13:40:52 +02:00
Felix Matouschek
6ba62f53e8 kubevirt_vm: Allow to specify template spec
By allowing to specify the template spec unnecessary abstraction is
avoided.

The following module args are replaced by the 'spec' arg:
  - termination_grace_period
  - interfaces
  - networks
  - volumes

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2023-07-18 11:31:32 +02:00
Felix Matouschek
b0971aca37 kubevirt_vm: Use {Instancetype,Preference}Matchers
Use InstancetypeMatchers and PreferenceMatchers directly instead of
providing multiple arguments to prevent unnecessary abstraction.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2023-07-18 10:41:15 +02:00
Felix Matouschek
68f5cc8e33 Update Ansible GitHub workflows
The workflows committed in the first commit were missing the
installation of required dependencies and other fixes.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2023-07-17 14:45:31 +02:00
Felix Matouschek
216df38df9 first commit
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2023-07-14 10:30:20 +02:00