diff --git a/tests/fixtures/layouts/reporting-github.yaml b/tests/fixtures/layouts/reporting-github.yaml index 0333d037a9..c35207af12 100644 --- a/tests/fixtures/layouts/reporting-github.yaml +++ b/tests/fixtures/layouts/reporting-github.yaml @@ -97,6 +97,21 @@ github: check: failure +- pipeline: + name: gate + manager: dependent + trigger: + github: + - event: pull_request + action: comment + comment: merge me + success: + github: + status: success + merge: true + failure: + github: {} + - job: name: base parent: null @@ -129,3 +144,6 @@ checks-api-reporting: jobs: - project-test1 + gate: + jobs: + - project-test1 diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py index 6160fa947c..6972136c0b 100644 --- a/tests/unit/test_github_driver.py +++ b/tests/unit/test_github_driver.py @@ -1597,6 +1597,10 @@ class TestGithubAppDriver(ZuulGithubAppTestCase): """Using the checks API only works with app authentication""" project = "org/project3" github = self.fake_github.getGithubClient(None) + repo = github.repo_from_project('org/project3') + repo._set_branch_protection( + 'master', contexts=['tenant-one/checks-api-reporting', + 'tenant-one/gate']) # pipeline reports pull request status both on start and success self.executor_server.hold_jobs_in_build = True @@ -1640,6 +1644,11 @@ class TestGithubAppDriver(ZuulGithubAppTestCase): ) self.assertIsNotNone(check_run["completed_at"]) + # Tell gate to merge to test checks requirements + self.fake_github.emitEvent(A.getCommentAddedEvent('merge me')) + self.waitUntilSettled() + self.assertTrue(A.is_merged) + @simple_layout("layouts/reporting-github.yaml", driver="github") def test_update_non_existing_check_run(self): project = "org/project3"