summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-09-16 03:24:34 +0000
committerGerrit Code Review <review@openstack.org>2022-09-16 03:24:34 +0000
commit861f9934af8ca8408d265cfeb4f8110e9eb92ceb (patch)
tree311071444a9ebc4372958208cdcb0428bfa8d6a1 /tests
parentdbee6e74f4d21a992e72a3498c299d210d467314 (diff)
parent9a3b028fa21013812585fcf1291bad130563c64c (diff)
downloadzuul-861f9934af8ca8408d265cfeb4f8110e9eb92ceb.tar.gz
Merge "Add option to include returned data in MQTT reporter"
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/config/mqtt-driver/git/common-config/zuul.d/config.yaml4
-rw-r--r--tests/unit/test_connection.py14
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/fixtures/config/mqtt-driver/git/common-config/zuul.d/config.yaml b/tests/fixtures/config/mqtt-driver/git/common-config/zuul.d/config.yaml
index c842e9424..1cee46f5c 100644
--- a/tests/fixtures/config/mqtt-driver/git/common-config/zuul.d/config.yaml
+++ b/tests/fixtures/config/mqtt-driver/git/common-config/zuul.d/config.yaml
@@ -7,11 +7,15 @@
start:
mqtt:
topic: "{tenant}/zuul_start/{pipeline}/{project}/{branch}"
+ # This doesn't make sense here -- there should be no return
+ # data yet, which is why we include it in this test.
+ include-returned-data: True
success:
gerrit:
Verified: 1
mqtt:
topic: "{tenant}/zuul_buildset/{pipeline}/{project}/{branch}"
+ include-returned-data: True
failure:
gerrit:
Verified: -1
diff --git a/tests/unit/test_connection.py b/tests/unit/test_connection.py
index b4c155240..bae4ff258 100644
--- a/tests/unit/test_connection.py
+++ b/tests/unit/test_connection.py
@@ -681,9 +681,13 @@ class TestMQTTConnection(ZuulTestCase):
'type': 'container_image'
}}
self.executor_server.returnData(
- "test", A, {"zuul": {"log_url": "some-log-url",
- 'artifacts': [artifact],
- }}
+ "test", A, {
+ "zuul": {
+ "log_url": "some-log-url",
+ 'artifacts': [artifact],
+ },
+ 'foo': 'bar',
+ }
)
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
@@ -703,6 +707,9 @@ class TestMQTTConnection(ZuulTestCase):
'test')
self.assertNotIn('result', mqtt_payload['buildset']['builds'][0])
self.assertNotIn('artifacts', mqtt_payload['buildset']['builds'][0])
+ builds = mqtt_payload['buildset']['builds']
+ test_job = [b for b in builds if b['job_name'] == 'test'][0]
+ self.assertNotIn('returned_data', test_job)
self.assertEquals(success_event.get('topic'),
'tenant-one/zuul_buildset/check/org/project/master')
@@ -720,6 +727,7 @@ class TestMQTTConnection(ZuulTestCase):
self.assertEquals(test_job['dependencies'], [])
self.assertEquals(test_job['artifacts'], [artifact])
self.assertEquals(test_job['log_url'], 'some-log-url/')
+ self.assertEquals(test_job['returned_data'], {'foo': 'bar'})
build_id = test_job["uuid"]
self.assertEquals(
test_job["web_url"],