aboutsummaryrefslogtreecommitdiff
path: root/tests/test_merge_config.py
diff options
context:
space:
mode:
authorPierre Riteau <pierre@stackhpc.com>2021-03-05 15:11:55 +0100
committerPierre Riteau <pierre@stackhpc.com>2021-03-05 15:12:23 +0100
commit2b723ead051b7f722ad61db1bb65a07259817719 (patch)
treecba804509572adc1d88fa1833a3ba6012398dde2 /tests/test_merge_config.py
parentcef8c8b3de97444f09a46d533cbc6654df9ac2e0 (diff)
downloadkolla-ansible-2b723ead051b7f722ad61db1bb65a07259817719.tar.gz
kolla-ansible-2b723ead051b7f722ad61db1bb65a07259817719.zip
Remove whitespace around equal signs in zookeeper.cfg
The merge_configs action plugin is updated with an option to control whether whitespace should be used around equal signs. The default remains to use whitespace: only zookeeper.cfg doesn't use them. This is to avoid issues with the zkCleanup.sh script which expects no whitespace. The ZooKeeper documentation also uses no whitespace in configuration file examples. Change-Id: Ia082a1c002cc4e8b04f7696fdee827b747c6d13f Closes-Bug: #1917490
Diffstat (limited to 'tests/test_merge_config.py')
-rw-r--r--tests/test_merge_config.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_merge_config.py b/tests/test_merge_config.py
index ab5427c1a..1a4cb3bc4 100644
--- a/tests/test_merge_config.py
+++ b/tests/test_merge_config.py
@@ -132,6 +132,29 @@ key2 = not_b
'''
+# TESTC_NO_WHITESPACE is TESTA + TESTB without whitespace around equal signs
+TESTC_NO_WHITESPACE = '''[DEFAULT]
+key1=b
+ c
+key2=v3
+ v4
+ v5
+key3=v3
+key3=v4
+key4=v4
+key4=
+
+[b]
+b_key1=1
+b_key2=2
+
+[c]
+c_key1=
+c_key2=1 2 3
+ 4 5 6
+
+'''
+
class OverrideConfigParserTest(base.BaseTestCase):
@@ -178,3 +201,12 @@ class OverrideConfigParserTest(base.BaseTestCase):
parser.write(output)
self.assertEqual(TESTC_NO_DEFAULT_SECTION, output.getvalue())
output.close()
+
+ def test_merge_no_whitespace(self):
+ parser = merge_configs.OverrideConfigParser(whitespace=False)
+ parser.parse(StringIO(TESTA))
+ parser.parse(StringIO(TESTB))
+ output = StringIO()
+ parser.write(output)
+ self.assertEqual(TESTC_NO_WHITESPACE, output.getvalue())
+ output.close()