From 2daf133a8090fa304441e324da8b6aeb69970587 Mon Sep 17 00:00:00 2001 From: emo Date: Tue, 5 Mar 2024 00:44:39 +0100 Subject: [PATCH] Automate the execution of all molecule scenarios --- README.md | 20 +++++--------------- Taskfile.yml | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 01646dc..8d62a98 100644 --- a/README.md +++ b/README.md @@ -217,22 +217,12 @@ Navigate to the root folder of the local copy of this git repository. cd test_linux_containers ``` -Install locally a snapshot version of `theliberatededge.test_linux_containers` -that will be used as the foundation for automated testing. +Run the following task to execute all of the Ansible Molecule test scenarios +in the project. ``` -LC_ALL=C.UTF-8 ansible-galaxy install -r requirements-test.yml --force +LTE_CONTAINER_ROOT_PWD= task test-all ``` -Execute all existing Ansible Molecule scenarios. - -``` -cd extensions -``` - -``` -LC_ALL=C.UTF-8 \ -LTE_CONTAINER_NAME= \ -LTE_CONTAINER_ROOT_PWD= \ - molecule test --all -``` +`LTE_CONTAINER_ROOT_PWD` is an environment variable denoting the password +of the `root` user in the testing container. diff --git a/Taskfile.yml b/Taskfile.yml index 3ff6bd1..c4fe596 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -13,3 +13,18 @@ tasks: lint-ansible: deps: [lint-yml] cmds: [LC_ALL=C.UTF-8 ansible-lint .] + init-tests: + cmds: + - LC_ALL=C.UTF-8 ansible-galaxy install -r requirements-test.yml --force + test-all: + deps: [init-tests] + dir: extensions + cmds: + - | + LC_ALL=C.UTF-8 \ + LTE_CONTAINER_NAME={{ .LTE_CONTAINER_NAME }} \ + LTE_CONTAINER_ROOT_PWD={{ .LTE_CONTAINER_ROOT_PWD }} \ + molecule test --all + vars: + LTE_CONTAINER_NAME: + sh: cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1