Fix test_load_governor on large machines

The test_load_governor fakes the load to be 100 and expects the
executor to deregister. However when running the tests on a really big
machine (72 cores) the test fails because the executor permits a load
of 180 before deregistering. This can be fixed by faking the load
relative to the cpu count.

Change-Id: Ia177605356e90fc33848097f9443fc2859ac61e2
This commit is contained in:
Tobias Henkel 2019-01-11 10:56:13 +01:00
parent 5fbc185236
commit 160cd6468b
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,7 @@
# under the License.
import logging
import multiprocessing
import os
import time
from unittest import mock
@ -472,7 +473,10 @@ class TestGovernor(ZuulTestCase):
loadavg_mock.return_value = (0.0, 0.0, 0.0)
self.executor_server.manageLoad()
self.assertTrue(self.executor_server.accepting_work)
loadavg_mock.return_value = (100.0, 100.0, 100.0)
# fake the load to be higher than permitted
fake_load = multiprocessing.cpu_count() * 2.6
loadavg_mock.return_value = (fake_load, fake_load, fake_load)
self.executor_server.manageLoad()
self.assertFalse(self.executor_server.accepting_work)