summaryrefslogtreecommitdiff
path: root/tests/remote
diff options
context:
space:
mode:
authorFelix Schmidt <felix.fs.schmidt@bmw.de>2019-01-14 09:23:09 +0100
committerFelix Schmidt <felix.fs.schmidt@bmw.de>2019-01-16 15:10:10 +0100
commitf303dea90b4c3789a41be6b9e186b0cb11aa3c99 (patch)
tree202c73c34f1836d6e0f0fec0773876f872861751 /tests/remote
parent177956510867529c2c4b2e0bd99f4526f462cdaf (diff)
downloadzuul-f303dea90b4c3789a41be6b9e186b0cb11aa3c99.tar.gz
Add action to host results in zuul_json callback
Currently, this information is missing completely, although it's very useful when somebody wants to analyze the Ansible run based on the JSON log. After proposing this patch also for ansible, I've learned that this info is already visible in the original Ansible json callback: https://github.com/ansible/ansible/pull/50853 So, I've just added this missing part to the zuul_json callback. Change-Id: I1ee043fc1be95ec3260d3fe427653ffe8c09b8f7
Diffstat (limited to 'tests/remote')
-rw-r--r--tests/remote/test_remote_zuul_json.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/remote/test_remote_zuul_json.py b/tests/remote/test_remote_zuul_json.py
index 11c03e207..36c6b6bb6 100644
--- a/tests/remote/test_remote_zuul_json.py
+++ b/tests/remote/test_remote_zuul_json.py
@@ -81,6 +81,22 @@ class TestZuulJSON(AnsibleZuulTestCase):
self.assertIn('rosebud', text)
self.assertNotIn('setec', text)
+ def test_json_task_action(self):
+ job = self._run_job('no-log')
+ with self.jobLog(job):
+ build = self.history[-1]
+ self.assertEqual(build.result, 'SUCCESS')
+
+ text = self._get_json_as_text(build)
+ json_result = json.loads(text)
+ tasks = json_result[0]['plays'][0]['tasks']
+ expected_actions = [
+ 'debug', 'debug', 'debug', 'copy', 'find', 'stat', 'debug'
+ ]
+ for i, expected in enumerate(expected_actions):
+ host_result = tasks[i]['hosts']['controller']
+ self.assertEquals(expected, host_result['action'])
+
def test_json_role_log(self):
job = self._run_job('json-role')
with self.jobLog(job):