forked from teemtee/tmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend coverage of prepare/finish ansible plugin with more images (te…
…emtee#3110) The coverage now matches what `prepare/install` is tested with. This change required refactoring of some bits of `prepare/install` test: * moving generic helpers into `tests/install.sh`, * changing tests for `ansible` plugin to use `tests/images.sh` instead of its original one-shot use of images. This gives us: * the same coverage for both plugins, * one place where new environment needs to be added, * less code duplication, more re-use of "image testing" helpers, * and, the best, it actually discovers a genuine bug: `ansible` plugins did not report Python interpreter as their essential requirement, therefore playbooks were impossible to run in some environments.
- Loading branch information
Showing
14 changed files
with
292 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# A CentOS 7 image tailored for tmt test suite | ||
# | ||
# tmt/tests/centos/7/upstream:latest | ||
# | ||
|
||
FROM quay.io/centos/centos:7 | ||
|
||
# Use latest vault repos, mirrors are gone after centos EOL | ||
RUN cd /etc/yum.repos.d/ \ | ||
&& sed '/mirrorlist/d' -i *repo \ | ||
&& sed 's|#baseurl=http://mirror.centos.org/centos/$releasever|baseurl=https://vault.centos.org/7.9.2009|' -i *repo | ||
|
||
# Populate yum cache | ||
RUN yum makecache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# A CentOS Stream 9 image tailored for tmt test suite | ||
# | ||
# tmt/tests/centos/stream9/upstream:latest | ||
# | ||
|
||
FROM quay.io/centos/centos:stream9 | ||
|
||
# Populate dnf cache | ||
RUN dnf makecache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
provision: | ||
how: container | ||
execute: | ||
how: tmt | ||
script: echo fake | ||
|
||
environment: | ||
SIMPLE: word | ||
SPACES: several words with spaces | ||
provision: | ||
how: container | ||
|
||
finish: | ||
- name: State before is valid (no file) | ||
order: 20 | ||
order: 80 | ||
how: shell | ||
script: bash -xc "! [ -f /tmp/finished ]" | ||
|
||
- name: Ansible we want to test | ||
order: 85 | ||
how: ansible | ||
playbook: playbook.yml | ||
extra-args: '-e ansible_remote_tmp=/tmp' | ||
|
||
- name: State after is as expected (file created) | ||
order: 70 | ||
order: 90 | ||
how: shell | ||
script: bash -xc "[ -f /tmp/finished ]" | ||
|
||
- name: Create a file that is pulled during the finish stage | ||
order: 80 | ||
order: 95 | ||
how: shell | ||
script: touch $TMT_PLAN_DATA/my_file.txt | ||
execute: | ||
how: tmt | ||
script: echo fake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ tag+: | |
- provision-container | ||
- provision-local | ||
- provision-virtual | ||
duration: 30m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
discover: | ||
how: fmf | ||
environment: | ||
SIMPLE: word | ||
SPACES: several words with spaces | ||
provision: | ||
how: container | ||
execute: | ||
how: tmt | ||
script: echo fake | ||
|
||
environment: | ||
SIMPLE: word | ||
SPACES: several words with spaces | ||
|
||
prepare: | ||
- name: State before is valid (no file) | ||
order: 80 | ||
how: shell | ||
script: bash -xc "! [ -f /tmp/prepared ]" | ||
|
||
- name: State after is as expected (file created) | ||
order: 90 | ||
how: shell | ||
script: bash -xc "[ -f /tmp/prepared ]" | ||
|
||
/local: | ||
prepare: | ||
prepare+: | ||
- name: Ansible we want to test | ||
order: 85 | ||
how: ansible | ||
playbook: playbook.yml | ||
extra-args: '-vvv' | ||
extra-args: '-vvv -e ansible_remote_tmp=/tmp' | ||
|
||
/remote: | ||
prepare: | ||
prepare+: | ||
- name: Ansible we want to test | ||
order: 85 | ||
how: ansible | ||
# This is the very same playbook as the local one, just living in tmt's repository. | ||
playbook: https://raw.githubusercontent.com/teemtee/tmt/main/tests/prepare/ansible/data/playbook.yml | ||
extra-args: '-vvv' | ||
extra-args: '-vvv -e ansible_remote_tmp=/tmp' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ tag+: | |
- provision-container | ||
- provision-local | ||
- provision-virtual | ||
duration: 30m |
Oops, something went wrong.