Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/prepare/bootc-ansible/data/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
13 changes: 13 additions & 0 deletions tests/prepare/bootc-ansible/data/plans.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
discover:
how: fmf
execute:
how: tmt

/centos-stream-10/prepare-ansible:
summary: "Test prepare/ansible on bootc guest - install tree package"
provision:
how: virtual
image: https://artifacts.dev.testing-farm.io/images/CentOS-Stream-10-image-mode-x86_64.qcow2
prepare:
how: ansible
playbook: playbook.yml
9 changes: 9 additions & 0 deletions tests/prepare/bootc-ansible/data/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Install tree package
hosts: all
become: true
tasks:
- name: Install tree
ansible.builtin.dnf:
name: tree
state: present
10 changes: 10 additions & 0 deletions tests/prepare/bootc-ansible/data/test.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
summary: Check that tree package was installed via prepare/ansible
description: |
Verify that the tree command is available after prepare/ansible
executed a playbook via the podman connection plugin on the bootc
guest container, committed the result, and rebooted.
test: |
# Verify tree is installed and working
tree --version
# Also verify the booted image shows we're running a modified image
bootc status --booted --format humanreadable
14 changes: 14 additions & 0 deletions tests/prepare/bootc-ansible/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
summary: Test prepare/ansible step on bootc guests
description: |
Verify that prepare/ansible playbooks are executed on bootc guests
using the podman connection plugin targeting a container started
from the current bootc image. Changes are committed, switched via
bootc, and applied after reboot.
link:
- verifies: https://github.com/teemtee/tmt/issues/4511
tag+:
- provision-only
- provision-virtual
require:
- tmt+provision-virtual
duration: 2h
35 changes: 35 additions & 0 deletions tests/prepare/bootc-ansible/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1

rlJournalStart
rlPhaseStartSetup
rlRun "pushd data"
rlRun "run=$(mktemp -d --tmpdir=/var/tmp/tmt)" 0 "Create run directory"
rlPhaseEnd

# Test prepare/ansible on bootc guest - should use podman connection plugin
rlPhaseStartTest "Prepare/ansible on bootc guest - install tree package"
rlRun -s "tmt -dddvvv run --scratch -i $run plan --name /plans/centos-stream-10/prepare-ansible"

# Verify ansible-playbook was invoked with podman connection
rlAssertGrep "ansible-playbook" $rlRun_LOG
rlAssertGrep "\-c containers.podman.podman" $rlRun_LOG

# Verify the container was committed
rlAssertGrep "podman commit" $rlRun_LOG

# Verify bootc switch was called
rlAssertGrep "switching to new image" $rlRun_LOG

# Verify reboot happened
rlAssertGrep "rebooting to apply new image" $rlRun_LOG

# Verify tree --version ran successfully in the test
rlAssertGrep "tree v" $rlRun_LOG
rlPhaseEnd

rlPhaseStartCleanup
rlRun "rm -rf $run" 0 "Remove run directory"
rlRun "popd"
rlPhaseEnd
rlJournalEnd
Loading