From 73bf3fc354ca78fb512b8c9b2e8967166dc5fa13 Mon Sep 17 00:00:00 2001 From: trfore Date: Sun, 5 May 2024 18:03:23 -0500 Subject: [PATCH] test: add ANSIBLE_ROLES_PATH to tox and update contribution guide --- CONTRIBUTING.md | 18 ++++++++++++++++++ tox.ini | 1 + 2 files changed, 19 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e34bd73..a6013ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,24 @@ pre-commit install ```sh pre-commit run --all-files + +# list environments and test +tox list +# lint all files +tox -e lint run +# run a specific test environment +tox -e py-ansible2.16-ubuntu20 run +# run all test in parallel +tox run-parallel +``` + +- For iterative development and testing, the tox molecule environments are written to accept `molecule` arguments. This allows for codebase changes to be tested as you write across multiple distros and versions of `ansible-core`. + +```sh +# molecule converge +tox -e py-ansible2.16-ubuntu20 run -- converge -s default +# molecule test w/o destroying the container +tox -r -e py-ansible2.16-ubuntu20-jre8 -- test -s ubuntu20-jre8 --destroy=never ``` ## Additional References diff --git a/tox.ini b/tox.ini index ea334df..268cb5e 100644 --- a/tox.ini +++ b/tox.ini @@ -23,6 +23,7 @@ commands = default: molecule {posargs:test -s default} jre8: molecule {posargs:test -s ubuntu-jre8} setenv = + ANSIBLE_ROLES_PATH={work_dir}/{env_name}/.ansible/roles MOLECULE_EPHEMERAL_DIRECTORY={work_dir}/{env_name}/.cache/molecule MOLECULE_NAME={env_name} centos: MOLECULE_IMAGE=trfore/docker-centos8-systemd