/plumb_unit

plumbing system used to run tests in protected and reproductible environments

Primary LanguageShell

plumb unit

Build Status

Plumb unit creates ansible roles with bash_unit testing framework or adds testing framework to existing role.

Launch the following command to create a skeleton to my-new-role for centos7. :

/path/to/plumb_unit/ansible_make_new_tested_role -D centos7 my_new_role

This will create a my_new_role directory with the following structure.

my_new_role
├── meta
│   └── main.yml
├── README.adoc
├── tasks
│   ├── interface.yml
│   └── main.yml
└── tests
    ├── ansible.cfg
    ├── bash_unit
    ├── run_tests_centos7.sh -> .run_tests.sh
    └── test_my_new_role_centos7

Using default testing environment

To run tests for your role, you can then go to the tests directory and run them:

cd tests
./run_tests_centos7.sh

This exemple will run tests in a centos7 container from docker hub. It will run all tests found in files named with pattern test_my-new-role*_centos7.

specifying distribution and version

To run test on a specific distribution, make a link for .run_tests.sh ending with _distribution:

ln -s .run_tests.sh run_tests_jessie.sh
./run_tests_jessie.sh

This will run tests from test_my-new-role*_jessie file.

cluster tests

cluster tests will be run by adding _cluster suffix to link and tests files:

ln -s run_tests.sh run_tests_jessie_cluster.sh
./run_tests_jessie_cluster.sh

This will run tests in test_my-new-role*_jessie_cluster.

Note that in this particular mode, tests are played from outside the containers. Tests then needs docker exec commands to access the container and check things within.