|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
ralph commented 6 years ago | ||
|
||
alivigni commented 6 years ago Option 1: You can have one call to run the first role then another | ||
|
||
|
||
|
||
merlinm commented 6 years ago | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
This PR is for work I've done to implement two new Standard Test Interface ansible roles for docker and RHTS.
Since this is my first foray into using ansible and my docker experience is still limited, I would appreciate a thorough review and constructive feedback from some ansible experts before this PR gets merged!
The standard-test-docker
role is for invoking tests against a docker image test subject in a similar manner to that described for other test subjects as described at https://fedoraproject.org/wiki/Changes/InvokingTestsAnsible#Invocation.
The standard-test-rhts
role is for running RHTS (Red Hat Test System) style tests. (For those unfamiliar with RHTS, it is basically an enhanced version of beakerlib. Many of the tests being open sourced as part of the "upstream first" effort are based on RHTS.) The role uses restraint to run the tests as tasks, since the restraint-rhts
package specifically includes support for running RHTS tests.
You can do a trial run that uses both of these new roles by running the following commands on a Fedora development machine:
Note: the standard-test-roles
package in merlinm's COPR repo contains the latest copy of the roles referenced by this PR.
sudo dnf install ansible python2-dnf libselinux-python sudo dnf copr enable merlinm/standard-test-roles sudo dnf install standard-test-roles mkdir scratch cd scratch git clone https://upstreamfirst.fedorainfracloud.org/diffutils.git cd diffutils sudo ansible-playbook test_docker.yml -e artifacts=$PWD/artifacts -e subjects=docker.io/fedora:latest ls -l $PWD/artifacts cat $PWD/artifacts/test.log
The playbook will take a while to run--especially the first time, if the fedora image needs to be downloaded. If you wish to examine the docker container that is used to run the tests before it gets cleaned up, set the environment variable FEDORA_TEST_DIAGNOSE=1.
You can also choose to run the tests directly on a local system by running the test_local.yml
playbook, but you would be wise to do so on a disposable VM:
sudo systemctl start sshd sudo ansible-playbook test_local.yml -e artifacts=$PWD/artifacts
Numerous additional examples of RHTS tests with test_local.yml
and test_docker.yml
playbooks can be found in many of the repos available at https://upstreamfirst.fedorainfracloud.org/browse/projects/.
Yes. Try "including" the playbook?
http://docs.ansible.com/ansible/playbooks_roles.html#task-versus-play-includes
It may be that you cannot include a playbook from a role -- and that you can only include a playbook from another playbook.
If this is the case, this may need to be refactored to bring this "outside" of the current role.