From f63dc09206a41c85edc92117c3e9cf3a3d49b820 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Tue, 1 Dec 2020 09:18:41 +0100 Subject: [PATCH] Limit usage of resources in the fullstack tests job To limit usage of resources (mostly memory) in the fullstack job and to avoid oom killer to kill e.g. mysqld service, this patch: * Makes number of API workers changeable by tests, as a parameter to EnvironmentDescription and defaults its value to 1. As neutron server is spawned separately for each test and is used only to process just few API requests during that single test so this should be still enough there, and where more API workers are needed (like some dhcp HA tests: TestDhcpAgentHARaceCondition) it can be changed, * reduces number of test run workers from 4 to 3 - job will run slower but hopefully more stable, * in the functional and fullstack tests job definition disable etcd3 service - this will not save us a lot of memory but still it's not needed at all so why to run it there. Change-Id: If19803ab6db144e2d17d6805d379c1c76d8fa343 Closes-Bug: #1906366 --- neutron/tests/fullstack/resources/config.py | 2 +- neutron/tests/fullstack/resources/environment.py | 4 +++- neutron/tests/fullstack/test_dhcp_agent.py | 3 +++ tox.ini | 2 +- zuul.d/base.yaml | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/neutron/tests/fullstack/resources/config.py b/neutron/tests/fullstack/resources/config.py index 17ba6195ea5..9d469cefe41 100644 --- a/neutron/tests/fullstack/resources/config.py +++ b/neutron/tests/fullstack/resources/config.py @@ -82,7 +82,7 @@ class NeutronConfigFixture(ConfigFixture): 'password': rabbitmq_environment.password, 'host': rabbitmq_environment.host, 'vhost': rabbitmq_environment.vhost}, - 'api_workers': '2', + 'api_workers': str(env_desc.api_workers), }, 'database': { 'connection': connection, diff --git a/neutron/tests/fullstack/resources/environment.py b/neutron/tests/fullstack/resources/environment.py index a2bb2f1f961..f42ae0c5cb5 100644 --- a/neutron/tests/fullstack/resources/environment.py +++ b/neutron/tests/fullstack/resources/environment.py @@ -40,7 +40,8 @@ class EnvironmentDescription(object): global_mtu=constants.DEFAULT_NETWORK_MTU, debug_iptables=False, log=False, report_bandwidths=False, has_placement=False, placement_port=None, - dhcp_scheduler_class=None, ml2_extension_drivers=None): + dhcp_scheduler_class=None, ml2_extension_drivers=None, + api_workers=1): self.network_type = network_type self.l2_pop = l2_pop self.qos = qos @@ -62,6 +63,7 @@ class EnvironmentDescription(object): if self.log: self.service_plugins += ',log' self.ml2_extension_drivers = ml2_extension_drivers + self.api_workers = api_workers @property def tunneling_enabled(self): diff --git a/neutron/tests/fullstack/test_dhcp_agent.py b/neutron/tests/fullstack/test_dhcp_agent.py index 6f0936fcbe5..a11a8ac1d59 100644 --- a/neutron/tests/fullstack/test_dhcp_agent.py +++ b/neutron/tests/fullstack/test_dhcp_agent.py @@ -38,6 +38,7 @@ class BaseDhcpAgentTest(base.BaseFullStackTestCase): ] boot_vm_for_test = True dhcp_scheduler_class = None + api_workers = 1 def setUp(self): host_descriptions = [ @@ -52,6 +53,7 @@ class BaseDhcpAgentTest(base.BaseFullStackTestCase): arp_responder=False, agent_down_time=self.agent_down_time, dhcp_scheduler_class=self.dhcp_scheduler_class, + api_workers=self.api_workers, ), host_descriptions) @@ -205,6 +207,7 @@ class TestDhcpAgentHARaceCondition(BaseDhcpAgentTest): agent_down_time = 30 number_of_hosts = 2 boot_vm_for_test = False + api_workers = 2 dhcp_scheduler_class = ('neutron.tests.fullstack.schedulers.dhcp.' 'AlwaysTheOtherAgentScheduler') diff --git a/tox.ini b/tox.ini index 576bd69e27a..f8f9f81e995 100644 --- a/tox.ini +++ b/tox.ini @@ -76,7 +76,7 @@ deps = commands = {toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir} {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin - stestr run --concurrency 4 {posargs} + stestr run --concurrency 3 {posargs} [testenv:dsvm-fullstack-gate] setenv = {[testenv:dsvm-fullstack]setenv} diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml index 4342d508bda..fc7c7e04ebe 100644 --- a/zuul.d/base.yaml +++ b/zuul.d/base.yaml @@ -24,6 +24,7 @@ devstack_services: # Ignore any default set by devstack. Emit a "disable_all_services". base: false + etcd3: false devstack_localrc: INSTALL_TESTONLY_PACKAGES: true DATABASE_PASSWORD: stackdb