Test canMerge also with checks api
There is no test case for the checks api that validates that canMerge also takes check runs into account if they are required. To test this we can simply add and trigger a gate pipeline after the reporting test case. Change-Id: Icb7e738a5f495e63b70c9a0937087909ff6422e8
This commit is contained in:
parent
df2e3af642
commit
1ed1c7f53d
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue