From 1fb797898b7bc1b349f00edb8088ab5c85cf6c67 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. Conflicts: neutron/tests/fullstack/resources/environment.py neutron/tests/fullstack/test_dhcp_agent.py zuul.d/base.yaml Change-Id: If19803ab6db144e2d17d6805d379c1c76d8fa343 Closes-Bug: #1906366 (cherry picked from commit f63dc09206a41c85edc92117c3e9cf3a3d49b820) --- .zuul.yaml | 1 + neutron/tests/fullstack/resources/config.py | 2 +- neutron/tests/fullstack/resources/environment.py | 3 ++- neutron/tests/fullstack/test_dhcp_agent.py | 4 +++- tox.ini | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 3d9ba2c0fd4..473c2c6e395 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -120,6 +120,7 @@ devstack_services: # Ignore any default set by devstack. Emit a "disable_all_services". base: false + etcd3: false devstack_localrc: USE_PYTHON3: true INSTALL_TESTONLY_PACKAGES: true diff --git a/neutron/tests/fullstack/resources/config.py b/neutron/tests/fullstack/resources/config.py index cff778be57f..29f2b34017e 100644 --- a/neutron/tests/fullstack/resources/config.py +++ b/neutron/tests/fullstack/resources/config.py @@ -74,7 +74,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 e3eb7f4af1b..7370176e781 100644 --- a/neutron/tests/fullstack/resources/environment.py +++ b/neutron/tests/fullstack/resources/environment.py @@ -40,7 +40,7 @@ class EnvironmentDescription(object): agent_down_time=75, router_scheduler=None, global_mtu=common_const.DEFAULT_NETWORK_MTU, debug_iptables=False, log=False, report_bandwidths=False, - ml2_extension_drivers=None): + ml2_extension_drivers=None, api_workers=1): self.network_type = network_type self.l2_pop = l2_pop self.qos = qos @@ -59,6 +59,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 339105c4f7f..7c6c6964afc 100644 --- a/neutron/tests/fullstack/test_dhcp_agent.py +++ b/neutron/tests/fullstack/test_dhcp_agent.py @@ -36,6 +36,7 @@ class BaseDhcpAgentTest(base.BaseFullStackTestCase): (constants.AGENT_TYPE_LINUXBRIDGE, {'l2_agent_type': constants.AGENT_TYPE_LINUXBRIDGE}) ] + api_workers = 1 def setUp(self): host_descriptions = [ @@ -48,7 +49,8 @@ class BaseDhcpAgentTest(base.BaseFullStackTestCase): environment.EnvironmentDescription( l2_pop=False, arp_responder=False, - agent_down_time=self.agent_down_time), + agent_down_time=self.agent_down_time, + api_workers=self.api_workers), host_descriptions) super(BaseDhcpAgentTest, self).setUp(env) diff --git a/tox.ini b/tox.ini index db804880265..4bd60429fba 100644 --- a/tox.ini +++ b/tox.ini @@ -96,7 +96,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:releasenotes] basepython = python3