Execute Github tests with only one scheduler
Currently, the canMerge check makes most of the tests fail when they are executed with multiple schedulers. The main reason are the fake github classes we are using as "backend" in our tests. Since each scheduler gets a different (fake) connection, each connection might have a different set of data during the test depending on which scheduler handleded the trigger event. When the canMerge check is executed by the wrong scheduler the test will fail, as the fake connection bound to this scheduler is not aware of the commit in question. As this is mainly a testing issue, we decided to limit the number of schedulers for the Github tests to 1. As a long term solution we should implement a HTTP server that serves as fake Github backend (similar to our FakeGerrit), so that the connection data isn't bound to a single python object. Change-Id: Ic4dcab061b5e0a1951e93da22debbb161a1f3ecb
This commit is contained in:
parent
2e27170dca
commit
9e157f1af3
|
@ -1299,6 +1299,7 @@ class TestGerritCircularDependencies(ZuulTestCase):
|
|||
class TestGithubCircularDependencies(ZuulTestCase):
|
||||
config_file = "zuul-gerrit-github.conf"
|
||||
tenant_config_file = "config/circular-dependencies/main.yaml"
|
||||
scheduler_count = 1
|
||||
|
||||
def test_cycle_not_ready(self):
|
||||
A = self.fake_github.openFakePullRequest("gh/project", "master", "A")
|
||||
|
|
|
@ -18,6 +18,7 @@ from tests.base import ZuulTestCase, simple_layout
|
|||
class TestGithubCrossRepoDeps(ZuulTestCase):
|
||||
"""Test Github cross-repo dependencies"""
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
@simple_layout('layouts/crd-github.yaml', driver='github')
|
||||
def test_crd_independent(self):
|
||||
|
|
|
@ -42,6 +42,7 @@ EMPTY_LAYOUT_STATE = LayoutState("", "", 0, None, {})
|
|||
|
||||
class TestGithubDriver(ZuulTestCase):
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
@simple_layout('layouts/basic-github.yaml', driver='github')
|
||||
def test_pull_event(self):
|
||||
|
@ -1318,6 +1319,7 @@ class TestGithubDriver(ZuulTestCase):
|
|||
class TestMultiGithubDriver(ZuulTestCase):
|
||||
config_file = 'zuul-multi-github.conf'
|
||||
tenant_config_file = 'config/multi-github/main.yaml'
|
||||
scheduler_count = 1
|
||||
|
||||
def test_multi_app(self):
|
||||
"""Test that we can handle multiple app."""
|
||||
|
@ -1335,6 +1337,7 @@ class TestMultiGithubDriver(ZuulTestCase):
|
|||
class TestGithubUnprotectedBranches(ZuulTestCase):
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
tenant_config_file = 'config/unprotected-branches/main.yaml'
|
||||
scheduler_count = 1
|
||||
|
||||
def test_unprotected_branches(self):
|
||||
tenant = self.scheds.first.sched.abide.tenants\
|
||||
|
@ -1653,6 +1656,7 @@ class TestGithubUnprotectedBranches(ZuulTestCase):
|
|||
|
||||
class TestGithubWebhook(ZuulTestCase):
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
def setUp(self):
|
||||
super(TestGithubWebhook, self).setUp()
|
||||
|
@ -1726,6 +1730,7 @@ class TestGithubWebhook(ZuulTestCase):
|
|||
|
||||
|
||||
class TestGithubShaCache(BaseTestCase):
|
||||
scheduler_count = 1
|
||||
|
||||
def testInsert(self):
|
||||
cache = GithubShaCache()
|
||||
|
@ -1817,6 +1822,7 @@ class TestGithubShaCache(BaseTestCase):
|
|||
class TestGithubAppDriver(ZuulGithubAppTestCase):
|
||||
"""Inheriting from ZuulGithubAppTestCase will enable app authentication"""
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
@simple_layout("layouts/reporting-github.yaml", driver="github")
|
||||
def test_reporting_checks_api(self):
|
||||
|
@ -2098,6 +2104,7 @@ class TestCheckRunAnnotations(ZuulGithubAppTestCase, AnsibleZuulTestCase):
|
|||
"""We need Github app authentication and be able to run Ansible jobs"""
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
tenant_config_file = "config/github-file-comments/main.yaml"
|
||||
scheduler_count = 1
|
||||
|
||||
def test_file_comments(self):
|
||||
project = "org/project"
|
||||
|
@ -2275,6 +2282,7 @@ class TestCheckRunAnnotations(ZuulGithubAppTestCase, AnsibleZuulTestCase):
|
|||
|
||||
class TestGithubDriverEnterise(ZuulGithubAppTestCase):
|
||||
config_file = 'zuul-github-driver-enterprise.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
@simple_layout('layouts/merging-github.yaml', driver='github')
|
||||
def test_report_pull_merge(self):
|
||||
|
@ -2312,6 +2320,7 @@ class TestGithubDriverEnterise(ZuulGithubAppTestCase):
|
|||
|
||||
class TestGithubDriverEnteriseLegacy(ZuulGithubAppTestCase):
|
||||
config_file = 'zuul-github-driver-enterprise.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
def setUp(self):
|
||||
self.old_version = FakeGithubEnterpriseClient.version
|
||||
|
|
|
@ -20,6 +20,7 @@ from tests.base import ZuulGithubAppTestCase, ZuulTestCase, simple_layout
|
|||
class TestGithubRequirements(ZuulTestCase):
|
||||
"""Test pipeline and trigger requirements"""
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
@simple_layout('layouts/requirements-github.yaml', driver='github')
|
||||
def test_pipeline_require_status(self):
|
||||
|
@ -598,6 +599,7 @@ class TestGithubRequirements(ZuulTestCase):
|
|||
class TestGithubAppRequirements(ZuulGithubAppTestCase):
|
||||
"""Test pipeline and trigger requirements with app authentication"""
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
scheduler_count = 1
|
||||
|
||||
@simple_layout("layouts/requirements-github.yaml", driver="github")
|
||||
def test_pipeline_require_check_run(self):
|
||||
|
|
Loading…
Reference in New Issue