summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Nemec <bnemec@redhat.com>2018-08-01 21:44:32 +0000
committerBen Nemec <bnemec@redhat.com>2018-08-02 15:31:08 +0000
commit98c0d2c1db7bbcb30b5bfe4f347bdb2124de25a5 (patch)
tree3ee9ece68b38812435d4a2619e6f7b68c0bed4bd
parent8d49f913495d3440ba841ac68d39de14e0671f37 (diff)
Update unit test to reflect latest oslo.config
Because we added the default config_source opt in oslo.config, it is now showing up in the GMR output and needs to be included in the expected content. However, for lower constraints testing we also need to continue to support the older versions without config_source, so the target_str is built dynamically based on whether the opt exists. Change-Id: I20b01285000ce84b69e8bd3cee8078edf03616f8
Notes
Notes (review): Code-Review+2: Stephen Finucane <stephenfin@redhat.com> Code-Review+1: yatin <ykarel@redhat.com> Code-Review+2: Doug Hellmann <doug@doughellmann.com> Workflow+1: Doug Hellmann <doug@doughellmann.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 10 Aug 2018 20:42:18 +0000 Reviewed-on: https://review.openstack.org/588088 Project: openstack/oslo.reports Branch: refs/heads/master
-rw-r--r--oslo_reports/tests/test_openstack_generators.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/oslo_reports/tests/test_openstack_generators.py b/oslo_reports/tests/test_openstack_generators.py
index f5b1cda..b2ddab8 100644
--- a/oslo_reports/tests/test_openstack_generators.py
+++ b/oslo_reports/tests/test_openstack_generators.py
@@ -94,6 +94,16 @@ class TestOpenstackGenerators(base.BaseTestCase):
94 model = os_cgen.ConfigReportGenerator(conf)() 94 model = os_cgen.ConfigReportGenerator(conf)()
95 model.set_current_view_type('text') 95 model.set_current_view_type('text')
96 96
97 # oslo.config added a default config_source opt which gets included
98 # in our output, but we also need to support older versions where that
99 # wasn't the case. This logic can be removed once the oslo.config
100 # lower constraint becomes >=6.4.0.
101 config_source_line = ' config_source = \n'
102 try:
103 conf.config_source
104 except cfg.NoSuchOptError:
105 config_source_line = ''
106
97 target_str = ('\ncheese: \n' 107 target_str = ('\ncheese: \n'
98 ' from_cow = True\n' 108 ' from_cow = True\n'
99 ' group_secrets = ***\n' 109 ' group_secrets = ***\n'
@@ -101,8 +111,9 @@ class TestOpenstackGenerators(base.BaseTestCase):
101 ' sharpness = 1\n' 111 ' sharpness = 1\n'
102 '\n' 112 '\n'
103 'default: \n' 113 'default: \n'
114 '%s'
104 ' crackers = triscuit\n' 115 ' crackers = triscuit\n'
105 ' secrets = ***') 116 ' secrets = ***') % config_source_line
106 self.assertEqual(target_str, six.text_type(model)) 117 self.assertEqual(target_str, six.text_type(model))
107 118
108 def test_package_report_generator(self): 119 def test_package_report_generator(self):