diff options
Diffstat (limited to 'tests/base.py')
-rw-r--r-- | tests/base.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/base.py b/tests/base.py index 731d6c3cc..fd927a92c 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1227,6 +1227,7 @@ class GerritWebServer(object): def stop(self): self.httpd.shutdown() self.thread.join() + self.httpd.server_close() class FakeGerritPoller(gerritconnection.GerritPoller): @@ -3625,10 +3626,11 @@ class RecordingExecutorServer(zuul.executor.server.ExecutorServer): self.log.debug('No running builds to release') return - self.log.debug("Releasing build %s (%s)" % (regex, len(builds))) + self.log.debug("Releasing build %s %s (%s)" % ( + regex, change, len(builds))) for build in builds: - if (not regex or re.match(regex, build.name) and - not change or build.change == change): + if ((not regex or re.match(regex, build.name)) and + (not change or build.change == change)): self.log.debug("Releasing build %s" % (build.parameters['zuul']['build'])) build.release() @@ -4096,6 +4098,7 @@ class WebProxyFixture(fixtures.Fixture): def _cleanup(self): self.httpd.shutdown() self.thread.join() + self.httpd.server_close() class ZuulWebFixture(fixtures.Fixture): @@ -4345,6 +4348,11 @@ class BaseTestCase(testtools.TestCase): handler.setFormatter(formatter) logger = logging.getLogger() + # It is possible that a stderr log handler is inserted before our + # addHandler below. If that happens we will emit all logs to stderr + # even when we don't want to. Error here to make it clear there is + # a problem as early as possible as it is easy to overlook. + self.assertEqual(logger.handlers, []) logger.setLevel(logging.DEBUG) logger.addHandler(handler) @@ -5173,6 +5181,11 @@ class ZuulTestCase(BaseTestCase): self.assertIsNotNone(build.start_time) self.assertIsNotNone(build.end_time) + def assertNoPipelineExceptions(self): + for tenant in self.scheds.first.sched.abide.tenants.values(): + for pipeline in tenant.layout.pipelines.values(): + self.assertEqual(0, pipeline._exception_count) + def assertFinalState(self): self.log.debug("Assert final state") # Make sure no jobs are running @@ -5199,6 +5212,7 @@ class ZuulTestCase(BaseTestCase): for pipeline in tenant.layout.pipelines.values(): if isinstance(pipeline.manager, ipm): self.assertEqual(len(pipeline.queues), 0) + self.assertNoPipelineExceptions() def shutdown(self): self.log.debug("Shutting down after tests") @@ -5625,6 +5639,7 @@ class ZuulTestCase(BaseTestCase): time.sleep(0.1) def refreshPipelines(self, sched): + ctx = None for tenant in sched.abide.tenants.values(): with tenant_read_lock(self.zk_client, tenant.name): for pipeline in tenant.layout.pipelines.values(): |