From edb49853056c6c67370722d3cfd7dd0492a7d70d Mon Sep 17 00:00:00 2001 From: Simon Westphahl Date: Wed, 17 Nov 2021 11:49:23 +0100 Subject: [PATCH] Allow running tests with multiple schedulers The number of schedulers can be defined via the ZUUL_SCHEDULER_COUNT environment variable (also forwarded by tox). Disclaimer: running the tests with multiple schedulers will still fail as not all test support multiple schedulers yet. Change-Id: Ie11467dcf0fc36a5e167adcbd29ac4f256e0b3c5 --- tests/base.py | 5 ++++- tests/unit/test_configloader.py | 1 + tox.ini | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/base.py b/tests/base.py index 094d88cf01..4e9829d8bf 100644 --- a/tests/base.py +++ b/tests/base.py @@ -130,6 +130,7 @@ import tests.fakegitlab FIXTURE_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') KEEP_TEMPDIRS = bool(os.environ.get('KEEP_TEMPDIRS', False)) +SCHEDULER_COUNT = int(os.environ.get('ZUUL_SCHEDULER_COUNT', 1)) def repack_repo(path): @@ -4488,6 +4489,7 @@ class ZuulTestCase(BaseTestCase): git_url_with_auth: bool = False log_console_port: int = 19885 validate_tenants = None + scheduler_count = SCHEDULER_COUNT def __getattr__(self, name): """Allows to access fake connections the old way, e.g., using @@ -4665,7 +4667,8 @@ class ZuulTestCase(BaseTestCase): self.builds = self.executor_server.running_builds self.scheds = SchedulerTestManager(self.validate_tenants) - self.createScheduler() + for _ in range(self.scheduler_count): + self.createScheduler() self.merge_server = None diff --git a/tests/unit/test_configloader.py b/tests/unit/test_configloader.py index 2cd330cc7e..af08ad1ac5 100644 --- a/tests/unit/test_configloader.py +++ b/tests/unit/test_configloader.py @@ -954,6 +954,7 @@ class TestTenantExtra(TenantParserTestCase): class TestTenantDuplicate(TenantParserTestCase): tenant_config_file = 'config/tenant-parser/duplicate.yaml' + scheduler_count = 1 def setUp(self): with testtools.ExpectedException(Exception, 'Duplicate configuration'): diff --git a/tox.ini b/tox.ini index 3707f21653..634d3a2ced 100644 --- a/tox.ini +++ b/tox.ini @@ -28,6 +28,7 @@ passenv = YARN_REGISTRY ZUUL_MYSQL_HOST ZUUL_POSTGRES_HOST + ZUUL_SCHEDULER_COUNT ZUUL_TEST_ROOT ZUUL_ZK_HOST ZUUL_ZK_CA