From 35542f79d3621c93781a82465f4058d3971b6b71 Mon Sep 17 00:00:00 2001 From: Artom Lifshitz Date: Tue, 22 Jan 2019 13:31:31 -0500 Subject: [PATCH] Add max_compute_nodes option This option indicates the number of (available) compute hosts in the deployment, and will be used by tests that require all their instances landing on the same host (ie, a single-compute deployment). The default value is a childish large number to make sure that tests that need a single node are skipped unless max_compute_nodes is set. Change-Id: Id274baeb13ce87783e35daff74bf4cfe67554900 --- README.rst | 2 ++ whitebox_tempest_plugin/api/compute/test_cpu_pinning.py | 2 ++ whitebox_tempest_plugin/config.py | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/README.rst b/README.rst index d7eb7a71..68b4406a 100644 --- a/README.rst +++ b/README.rst @@ -57,6 +57,8 @@ Install, configure and run # ctlplane_ssh_username = heat-admin # ctlplane_ssh_private_key_path = /home/stack/.ssh/id_rsa containers = true + max_compute_nodes = 2 # Some tests depend on there being a single + # (available) compute node 3. Execute the tests. :: diff --git a/whitebox_tempest_plugin/api/compute/test_cpu_pinning.py b/whitebox_tempest_plugin/api/compute/test_cpu_pinning.py index 95776b96..beb376dd 100644 --- a/whitebox_tempest_plugin/api/compute/test_cpu_pinning.py +++ b/whitebox_tempest_plugin/api/compute/test_cpu_pinning.py @@ -80,6 +80,8 @@ class CPUPolicyTest(BaseTest): flavor = self.create_flavor(cpu_policy='shared') self.create_test_server(flavor=flavor['id']) + @testtools.skipUnless(CONF.whitebox.max_compute_nodes < 2, + 'Single compute node required.') def test_cpu_dedicated(self): """Ensure an instance with 'dedicated' pinning policy work. diff --git a/whitebox_tempest_plugin/config.py b/whitebox_tempest_plugin/config.py index 56ca1192..57110e77 100644 --- a/whitebox_tempest_plugin/config.py +++ b/whitebox_tempest_plugin/config.py @@ -52,4 +52,9 @@ opts = [ "While this looks like a poor man's DNS, this is needed " "because the environment running the test does not necessarily " "have the ctlplane DNS accessible."), + cfg.IntOpt( + 'max_compute_nodes', + default=31337, + help="Number of compute hosts in the deployment. Some tests depend " + "on there being a single compute host."), ]