summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-07-07 06:37:26 +0000
committerGerrit Code Review <review@openstack.org>2022-07-07 06:37:26 +0000
commit9a28a18d3376ec73b64f3bc5be9c137b8248f5ea (patch)
treeefebfc0f0491603bc9dd305e436a16018e7d94ff /tests
parente2a827e48a8ecfda12b2fe3da18c0d4e41cfd753 (diff)
parent1cdf491a2e2536f1643cb7d36fa49148611e2f66 (diff)
downloadzuul-9a28a18d3376ec73b64f3bc5be9c137b8248f5ea.tar.gz
Merge "Handle non default loopvars in Ansible callback stream plugin"
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/config/streamer/git/common-config/playbooks/python27.yaml12
-rw-r--r--tests/unit/test_streaming.py5
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/fixtures/config/streamer/git/common-config/playbooks/python27.yaml b/tests/fixtures/config/streamer/git/common-config/playbooks/python27.yaml
index 8485b04ce..397439f61 100644
--- a/tests/fixtures/config/streamer/git/common-config/playbooks/python27.yaml
+++ b/tests/fixtures/config/streamer/git/common-config/playbooks/python27.yaml
@@ -11,6 +11,18 @@
Debug Test Token String
Message
+ # Logging of loops is special so we do a simple one iteration
+ # loop and check that we log things properly
+ - name: Override ansible_loop_var
+ set_fact:
+ _testing_fact: "{{ other_loop_var }}"
+ with_random_choice:
+ - "one"
+ - "two"
+ - "three"
+ loop_control:
+ loop_var: "other_loop_var"
+
# Do not finish until test creates the flag file
- wait_for:
state: present
diff --git a/tests/unit/test_streaming.py b/tests/unit/test_streaming.py
index f323cd82a..ba3117f59 100644
--- a/tests/unit/test_streaming.py
+++ b/tests/unit/test_streaming.py
@@ -295,6 +295,11 @@ class TestStreaming(TestStreamingBase):
match = r.search(self.streaming_data[None])
self.assertNotEqual(match, None)
+ # Check that we logged loop_var contents properly
+ pattern = r'ok: "(one|two|three)"'
+ m = re.search(pattern, self.streaming_data[None])
+ self.assertNotEqual(m, None)
+
def runWSClient(self, port, build_uuid):
client = WSClient(port, build_uuid)
client.event.wait()