Convert alternatives runtimes molecule to ansible verifier

This commit is contained in:
Max Gautier
2025-06-13 17:41:03 +02:00
parent 1ccb3a38a2
commit 5671037b0e
9 changed files with 64 additions and 98 deletions

View File

@@ -25,4 +25,4 @@ provisioner:
create: ../../../../../tests/cloud_playbooks/create-kubevirt.yml
prepare: ../../../molecule/prepare.yml
verifier:
name: testinfra
name: ansible

View File

@@ -1,29 +0,0 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_run(host):
youkiruntime = "/usr/local/bin/youki"
with host.sudo():
cmd = host.command(youkiruntime + " --version")
assert cmd.rc == 0
assert "youki" in cmd.stdout
def test_run_pod(host):
runtime = "youki"
run_command = "/usr/local/bin/crictl run --with-pull --runtime {} /tmp/container.json /tmp/sandbox.json".format(runtime)
with host.sudo():
cmd = host.command(run_command)
assert cmd.rc == 0
with host.sudo():
log_f = host.file("/tmp/youki1.0.log")
assert log_f.exists
assert b"Hello from Docker" in log_f.content

View File

@@ -0,0 +1,19 @@
---
- name: Test youki
hosts: all
gather_facts: false
tasks:
- name: Get kubespray defaults
import_role:
name: ../../../../../kubespray_defaults
- name: Test version
command: "{{ bin_dir }}/youki --version"
register: youki_version
failed_when: >
youki_version is failed or
'youki' not in youki_version.stdout
- name: Test run container
import_playbook: ../../../molecule/test_runtime.yml
vars:
container_runtime: youki