Browse Source

Merge "Update unit test to reflect latest oslo.config"

Zuul 8 months ago
parent
commit
33e9c5d46b
1 changed files with 12 additions and 1 deletions
  1. 12
    1
      oslo_reports/tests/test_openstack_generators.py

+ 12
- 1
oslo_reports/tests/test_openstack_generators.py View File

@@ -94,6 +94,16 @@ class TestOpenstackGenerators(base.BaseTestCase):
94 94
         model = os_cgen.ConfigReportGenerator(conf)()
95 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 107
         target_str = ('\ncheese: \n'
98 108
                       '  from_cow = True\n'
99 109
                       '  group_secrets = ***\n'
@@ -101,8 +111,9 @@ class TestOpenstackGenerators(base.BaseTestCase):
101 111
                       '  sharpness = 1\n'
102 112
                       '\n'
103 113
                       'default: \n'
114
+                      '%s'
104 115
                       '  crackers = triscuit\n'
105
-                      '  secrets = ***')
116
+                      '  secrets = ***') % config_source_line
106 117
         self.assertEqual(target_str, six.text_type(model))
107 118
 
108 119
     def test_package_report_generator(self):

Loading…
Cancel
Save