summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Libosvar <libosvar@redhat.com>2018-04-20 14:01:46 +0000
committerJakub Libosvar <libosvar@redhat.com>2018-04-20 14:01:46 +0000
commit98e5f017146cb0de8539a63ed89efce8c2d05728 (patch)
treea5b123e4463a5ea83940259eb6fe579c3203fb4c
parentb6db5df451f3870199d123858fb0c330b0f78b17 (diff)
fullstack: Simplify ConfigFixture
ConfigFixture composed ConfigFileFixture instead of inheritance. This patch uses inheritance over composition in order to make ConfigFileFixture attributes accesible from the outside. Change-Id: I8c1c38245867111cb46c6f9493529ff3374593a0
Notes
Notes (review): Code-Review+2: Brian Haley <haleyb.dev@gmail.com> Code-Review+2: Slawek Kaplonski <skaplons@redhat.com> Workflow+1: Slawek Kaplonski <skaplons@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 23 Apr 2018 12:15:48 +0000 Reviewed-on: https://review.openstack.org/563131 Project: openstack/neutron Branch: refs/heads/master
-rw-r--r--neutron/tests/fullstack/resources/config.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/neutron/tests/fullstack/resources/config.py b/neutron/tests/fullstack/resources/config.py
index afc6438..db601ae 100644
--- a/neutron/tests/fullstack/resources/config.py
+++ b/neutron/tests/fullstack/resources/config.py
@@ -16,7 +16,6 @@ import os
16import shutil 16import shutil
17import tempfile 17import tempfile
18 18
19import fixtures
20from neutron_lib import constants 19from neutron_lib import constants
21 20
22from neutron.common import utils 21from neutron.common import utils
@@ -28,7 +27,7 @@ from neutron.tests.common import helpers as c_helpers
28PHYSICAL_NETWORK_NAME = "physnet1" 27PHYSICAL_NETWORK_NAME = "physnet1"
29 28
30 29
31class ConfigFixture(fixtures.Fixture): 30class ConfigFixture(config_fixtures.ConfigFileFixture):
32 """A fixture that holds an actual Neutron configuration. 31 """A fixture that holds an actual Neutron configuration.
33 32
34 Note that 'self.config' is intended to only be updated once, during 33 Note that 'self.config' is intended to only be updated once, during
@@ -37,18 +36,10 @@ class ConfigFixture(fixtures.Fixture):
37 is initializing a new instance of the class. 36 is initializing a new instance of the class.
38 """ 37 """
39 def __init__(self, env_desc, host_desc, temp_dir, base_filename): 38 def __init__(self, env_desc, host_desc, temp_dir, base_filename):
40 super(ConfigFixture, self).__init__() 39 super(ConfigFixture, self).__init__(
41 self.config = config_fixtures.ConfigDict() 40 base_filename, config_fixtures.ConfigDict(), temp_dir)
42 self.env_desc = env_desc 41 self.env_desc = env_desc
43 self.host_desc = host_desc 42 self.host_desc = host_desc
44 self.temp_dir = temp_dir
45 self.base_filename = base_filename
46
47 def _setUp(self):
48 cfg_fixture = config_fixtures.ConfigFileFixture(
49 self.base_filename, self.config, self.temp_dir)
50 self.useFixture(cfg_fixture)
51 self.filename = cfg_fixture.filename
52 43
53 def _generate_namespace_suffix(self): 44 def _generate_namespace_suffix(self):
54 return utils.get_rand_name(prefix='test') 45 return utils.get_rand_name(prefix='test')