From 5c3107a6291cdf9a1b0742a9307ac92f45c29304 Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Tue, 2 May 2023 17:27:27 +0200
Subject: [PATCH] change ANSIBLE_HOME instead of collections path only, set
 remote tmp for test

---
 test/conftest.py            | 10 ++++------
 test/test_playbook_utils.py |  3 ++-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/test/conftest.py b/test/conftest.py
index ffbfaae..cd91fb5 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -54,15 +54,13 @@ def ansible_playbook_bin():
         subprocess.check_call([pip_path, 'install', 'ansible',
                                'ansible_runner'])
 
+        # Set environment variable for a custom Ansible home
+        os.environ['ANSIBLE_HOME'] = venv_dir
+
         # Add Ansible Galaxy collection
         galaxy_path = os.path.join(venv_dir, 'bin', 'ansible-galaxy')
         subprocess.check_call([galaxy_path, 'collection', 'install',
-                               TEST_CONFIG['collection-name'], '-p',
-                               os.path.join(venv_dir, 'collections')])
-
-        # Set the environment variable for the custom collections path
-        os.environ['ANSIBLE_COLLECTIONS_PATH'] = \
-            os.path.join(venv_dir, 'collections')
+                               TEST_CONFIG['collection-name']])
 
         yield os.path.join(venv_dir, 'bin', 'ansible-playbook')
 
diff --git a/test/test_playbook_utils.py b/test/test_playbook_utils.py
index 7eac195..7d51956 100644
--- a/test/test_playbook_utils.py
+++ b/test/test_playbook_utils.py
@@ -22,7 +22,8 @@ def test_run_playbook(ansible_playbook_bin, playbook_filename):
             ansible_playbook_bin,
             '-i', 'localhost,',
             playbook_filename,
-            '--connection=local'
+            '--connection=local',
+            '-e', 'ansible_remote_tmp=/tmp'
         ],
         capture_output=True,
         check=False
-- 
GitLab