From cf1ec07eabbc6f64895e1896668dd97d2843acb2 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Wed, 21 Dec 2022 09:53:18 -0500 Subject: [PATCH] Changes to run sanity tests locally Use a Makefile arg for the ansible-test sanity CLI args defaults to --docker in the future we probably need to customize python versions Copy the rule exception for Ansible 2.15 this helps people who are running from Ansible devel --- Makefile | 20 ++++++++++++-------- awx_collection/tests/sanity/ignore-2.15.txt | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 awx_collection/tests/sanity/ignore-2.15.txt diff --git a/Makefile b/Makefile index d86e9779a4..1185666e76 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,17 @@ VERSION := $(shell $(PYTHON) tools/scripts/scm_version.py) # ansible-test requires semver compatable version, so we allow overrides to hack it COLLECTION_VERSION ?= $(shell $(PYTHON) tools/scripts/scm_version.py | cut -d . -f 1-3) +# args for the ansible-test sanity command +COLLECTION_SANITY_ARGS ?= --docker +# collection unit testing directories +COLLECTION_TEST_DIRS ?= awx_collection/test/awx +# collection integration test directories (defaults to all) +COLLECTION_TEST_TARGET ?= +# args for collection install +COLLECTION_PACKAGE ?= awx +COLLECTION_NAMESPACE ?= awx +COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE) +COLLECTION_TEMPLATE_VERSION ?= false # NOTE: This defaults the container image version to the branch that's active COMPOSE_TAG ?= $(GIT_BRANCH) @@ -290,13 +301,6 @@ test: cd awxkit && $(VENV_BASE)/awx/bin/tox -re py3 awx-manage check_migrations --dry-run --check -n 'missing_migration_file' -COLLECTION_TEST_DIRS ?= awx_collection/test/awx -COLLECTION_TEST_TARGET ?= -COLLECTION_PACKAGE ?= awx -COLLECTION_NAMESPACE ?= awx -COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE) -COLLECTION_TEMPLATE_VERSION ?= false - test_collection: rm -f $(shell ls -d $(VENV_BASE)/awx/lib/python* | head -n 1)/no-global-site-packages.txt if [ "$(VENV_BASE)" ]; then \ @@ -339,7 +343,7 @@ test_collection_sanity: if ! [ -x "$(shell command -v ansible-test)" ]; then pip install ansible-core; fi ansible --version COLLECTION_VERSION=1.0.0 make install_collection - cd $(COLLECTION_INSTALL) && ansible-test sanity --docker + cd $(COLLECTION_INSTALL) && ansible-test sanity $(COLLECTION_SANITY_ARGS) test_collection_integration: install_collection cd $(COLLECTION_INSTALL) && ansible-test integration $(COLLECTION_TEST_TARGET) diff --git a/awx_collection/tests/sanity/ignore-2.15.txt b/awx_collection/tests/sanity/ignore-2.15.txt new file mode 100644 index 0000000000..19512ea0c1 --- /dev/null +++ b/awx_collection/tests/sanity/ignore-2.15.txt @@ -0,0 +1 @@ +plugins/modules/export.py validate-modules:nonexistent-parameter-documented # needs awxkit to construct argspec