def test_configuration_override_affecting_min(self): # Given cores = multiprocessing.cpu_count() self.config.set('executor', 'max_starting_builds', '1') # When sensor = StartingBuildsSensor(None, cores * 2.5, self.config) # Then self.assertEqual(sensor.max_starting_builds, 1) self.assertEqual(sensor.min_starting_builds, 1)
def test_configuration_not_exists(self): # Given cores = multiprocessing.cpu_count() # When sensor = StartingBuildsSensor(None, cores * 2.5, self.config) # Then coefficient = 2 if multiprocessing.cpu_count() <= 4 else 1 max_default = int(cores * 2.5 * coefficient) self.assertEqual(sensor.max_starting_builds, max_default) self.assertEqual(sensor.min_starting_builds, max(int(cores / 2), 1))