From 78dcf4c992c5c3189675c7f579864c9140cf5898 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Fri, 23 Sep 2022 18:50:36 -0500 Subject: [PATCH] Outsource %ansible_test_unit logic to helper script We want %ansible_test_unit to retrieve the collection name{,space} from galaxy.yml. This removes the need for the %collection_name{,space} macros and utilizes ansible_collection.py's more robust approach to running the tests. --- macros.ansible | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/macros.ansible b/macros.ansible index 856688e..0c81432 100644 --- a/macros.ansible +++ b/macros.ansible @@ -13,12 +13,10 @@ --filelist %{ansible_collection_filelist} } +%ansible_test_unit() %{shrink: +%{_rpmconfigdir}/ansible_collection.py test -- +--python-interpreter %{__python3} --local %{?*} +} -%ansible_test_unit() %{expand:\\\ -mkdir -p ../ansible_collections/%{collection_namespace} -cp -a $(pwd) ../ansible_collections/%{collection_namespace}/%{collection_name} -pushd ../ansible_collections/%{collection_namespace}/%{collection_name} -ansible-test units --python-interpreter %{__python3} --local %{?*} -popd} %ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/