Fix test race with executor stats
The stats for the number of executors online/accepting are now calculated from the component registry. The variable used internally in the executor to record whether it is accepting or not has an incorrect initial value. Executors accept work as soon as they start, then periodically the governor runs and re-evaluates. At that time the internal flag, and now component registry, are updated. Tests that check the emitted stats can race depending on whether they run long enough for the governor to run. By correcting the initial value, we will have predictable and correct stats output. Change-Id: I6b84efb9292b6cb6fa439a1a46d47ee0ce1c4254
This commit is contained in:
parent
bd1a669cc8
commit
aa8bcfd874
|
@ -119,7 +119,7 @@ class TestSchedulerZone(ZuulTestCase):
|
|||
# be two executors online (one unzoned and one zoned)
|
||||
# TODO(corvus): remove deprecated top-level stats in 5.0
|
||||
self.assertReportedStat(
|
||||
'zuul.executors.online', value='1', kind='g')
|
||||
'zuul.executors.online', value='2', kind='g')
|
||||
self.assertReportedStat(
|
||||
'zuul.executors.unzoned.online', value='1', kind='g')
|
||||
self.assertReportedStat(
|
||||
|
@ -156,7 +156,7 @@ class TestSchedulerZone(ZuulTestCase):
|
|||
|
||||
# Validate that both (zoned and unzoned) executors are accepting work
|
||||
self.assertReportedStat(
|
||||
'zuul.executors.accepting', value='1', kind='g')
|
||||
'zuul.executors.accepting', value='2', kind='g')
|
||||
self.assertReportedStat(
|
||||
'zuul.executors.unzoned.accepting', value='1', kind='g')
|
||||
self.assertReportedStat(
|
||||
|
|
|
@ -2749,7 +2749,7 @@ class ExecutorServer(BaseMergeServer):
|
|||
# If the execution driver ever becomes configurable again,
|
||||
# this is where it would happen.
|
||||
execution_wrapper_name = 'bubblewrap'
|
||||
self.accepting_work = False
|
||||
self.accepting_work = True
|
||||
self.execution_wrapper = connections.drivers[execution_wrapper_name]
|
||||
|
||||
self.update_queue = DeduplicateQueue()
|
||||
|
|
Loading…
Reference in New Issue