diff options
author | Zuul <zuul@review.opendev.org> | 2019-09-12 15:46:59 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-09-12 15:46:59 +0000 |
commit | c9227360e2f4f26ae904cfbd874b50420db69fe4 (patch) | |
tree | e4071a8108234bcc95de19957f56ada296c938e7 /tests | |
parent | d014e3512548939178683a47eaefa4a1a7b79573 (diff) | |
parent | 2d8b45738d1958f52f689f89883f8f61a6dec1c6 (diff) | |
download | zuul-c9227360e2f4f26ae904cfbd874b50420db69fe4.tar.gz |
Merge "Pass zuul_success to cleanup playbooks"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/base.py | 4 | ||||
-rw-r--r-- | tests/fixtures/config/cleanup-playbook/git/common-config/playbooks/cleanup.yaml | 6 | ||||
-rw-r--r-- | tests/unit/test_v3.py | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/tests/base.py b/tests/base.py index 4dcafe003..1ddaf084d 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1874,8 +1874,8 @@ class RecordingAnsibleJob(zuul.executor.server.AnsibleJob): self.recordResult(None) return self.result - def runCleanupPlaybooks(self): - super(RecordingAnsibleJob, self).runCleanupPlaybooks() + def runCleanupPlaybooks(self, success): + super(RecordingAnsibleJob, self).runCleanupPlaybooks(success) if self.result is not None: self.recordResult(self.result) diff --git a/tests/fixtures/config/cleanup-playbook/git/common-config/playbooks/cleanup.yaml b/tests/fixtures/config/cleanup-playbook/git/common-config/playbooks/cleanup.yaml index ca83def21..863b942e4 100644 --- a/tests/fixtures/config/cleanup-playbook/git/common-config/playbooks/cleanup.yaml +++ b/tests/fixtures/config/cleanup-playbook/git/common-config/playbooks/cleanup.yaml @@ -1,5 +1,5 @@ - hosts: all tasks: - - file: - path: "{{zuul._test.test_root}}/{{zuul.build}}.cleanup.flag" - state: touch + - copy: + content: "{{ zuul_success }}" + dest: "{{ zuul._test.test_root }}/{{ zuul.build }}.cleanup.flag" diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py index 9636c90e9..5c6c1d687 100644 --- a/tests/unit/test_v3.py +++ b/tests/unit/test_v3.py @@ -2925,6 +2925,8 @@ class TestCleanupPlaybooks(AnsibleZuulTestCase): cleanup_flag = os.path.join(self.test_root, build.uuid + '.cleanup.flag') self.assertTrue(os.path.exists(cleanup_flag)) + with open(cleanup_flag) as f: + self.assertEqual('True', f.readline()) def test_cleanup_playbook_failure(self): # Test that the cleanup run is performed @@ -2950,6 +2952,8 @@ class TestCleanupPlaybooks(AnsibleZuulTestCase): cleanup_flag = os.path.join(self.test_root, build.uuid + '.cleanup.flag') self.assertTrue(os.path.exists(cleanup_flag)) + with open(cleanup_flag) as f: + self.assertEqual('False', f.readline()) def test_cleanup_playbook_abort(self): # Test that when we abort a job the cleanup run is performed |