Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit e7c5024

Browse files
committed
fix wrong word case
1 parent 651a9e2 commit e7c5024

4 files changed

Lines changed: 14 additions & 19 deletions

File tree

haproxy/helper/backend_helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def get_websocket_setting(vhosts, service_alias):
5050
for v in vhosts:
5151
if service_alias == v["service_alias"]:
5252
if v["scheme"].lower() in ["ws", "wss"]:
53-
websocket_setting.append("OPTION http-server-close")
53+
websocket_setting.append("option http-server-close")
5454
break
5555
return websocket_setting
5656

@@ -76,7 +76,7 @@ def get_balance_setting(details, service_alias):
7676
setting = []
7777
balance = get_service_attribute(details, "balance", service_alias)
7878
if balance:
79-
setting.append("BALANCE %s" % balance)
79+
setting.append("balance %s" % balance)
8080
return setting
8181

8282

@@ -109,7 +109,7 @@ def get_http_check_setting(details, service_alias):
109109
setting = []
110110
http_check = get_service_attribute(details, "http_check", service_alias)
111111
if http_check:
112-
setting.append("OPTION httpchk %s" % http_check)
112+
setting.append("option httpchk %s" % http_check)
113113
return setting
114114

115115

@@ -135,7 +135,7 @@ def get_options_setting(details, service_alias):
135135
options = get_service_attribute(details, 'option', service_alias)
136136
if options:
137137
for option in options:
138-
setting.append("OPTION %s" % option)
138+
setting.append("option %s" % option)
139139
return setting
140140

141141

tests/unit/helper/test_backend_helper.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def test_get_websocket_setting(self):
6969
{'service_alias': 'web-c', 'path': '', 'host': 'c.com', 'scheme': 'wss', 'port': '80'},
7070
{'service_alias': 'web-c', 'path': '', 'host': 'c.com', 'scheme': 'https', 'port': '80'}]
7171

72-
self.assertEqual(['OPTION http-server-close'], get_websocket_setting(vhosts, 'web-a'))
73-
self.assertEqual(['OPTION http-server-close'], get_websocket_setting(vhosts, 'web-b'))
74-
self.assertEqual(['OPTION http-server-close'], get_websocket_setting(vhosts, 'web-c'))
72+
self.assertEqual(['option http-server-close'], get_websocket_setting(vhosts, 'web-a'))
73+
self.assertEqual(['option http-server-close'], get_websocket_setting(vhosts, 'web-b'))
74+
self.assertEqual(['option http-server-close'], get_websocket_setting(vhosts, 'web-c'))
7575
self.assertEqual([], get_websocket_setting(vhosts, 'web-d'))
7676
self.assertEqual([], get_websocket_setting(vhosts, 'web-e'))
7777

@@ -80,7 +80,7 @@ def test_get_balance_setting(self):
8080
'web-b': {'balance': ''},
8181
'web-c': {}}
8282

83-
self.assertEqual(["BALANCE balance_a"], get_balance_setting(details, 'web-a'))
83+
self.assertEqual(["balance balance_a"], get_balance_setting(details, 'web-a'))
8484
self.assertEqual([], get_balance_setting(details, 'web-b'))
8585
self.assertEqual([], get_balance_setting(details, 'web-c'))
8686
self.assertEqual([], get_balance_setting(details, 'web-d'))
@@ -133,7 +133,7 @@ def test_http_check_setting(self):
133133
'web-b': {'http_check': ''},
134134
'web-c': {}}
135135

136-
self.assertEqual(["OPTION httpchk check_a"], get_http_check_setting(details, 'web-a'))
136+
self.assertEqual(["option httpchk check_a"], get_http_check_setting(details, 'web-a'))
137137
self.assertEqual([], get_http_check_setting(details, 'web-b'))
138138
self.assertEqual([], get_http_check_setting(details, 'web-c'))
139139
self.assertEqual([], get_http_check_setting(details, 'web-d'))
@@ -166,8 +166,8 @@ def test_get_options_setting(self):
166166
'web-c': {'option': []},
167167
'web-d': {}}
168168

169-
self.assertEqual(["OPTION opt1", "OPTION opt2"], get_options_setting(details, 'web-a'))
170-
self.assertEqual(["OPTION opt3"], get_options_setting(details, 'web-b'))
169+
self.assertEqual(["option opt1", "option opt2"], get_options_setting(details, 'web-a'))
170+
self.assertEqual(["option opt3"], get_options_setting(details, 'web-b'))
171171
self.assertEqual([], get_options_setting(details, 'web-c'))
172172
self.assertEqual([], get_options_setting(details, 'web-d'))
173173
self.assertEqual([], get_options_setting(details, 'web-e'))

tests/unit/test_haproxycfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_config_backend_sections(self, mock_init, mock_details, mock_services, m
322322
{'container_name': 'HW_2', 'proto': 'http', 'port': '80', 'addr': '10.7.0.3'}]}
323323
mock_vhosts.return_value = [
324324
{'service_alias': 'HW', 'path': '', 'host': 'a.com', 'scheme': 'http', 'port': '80'}]
325-
self.assertEqual(OrderedDict([('backend SERVICE_HW', ['BALANCE source',
325+
self.assertEqual(OrderedDict([('backend SERVICE_HW', ['balance source',
326326
'server HW_1 10.7.0.2:80 check',
327327
'server HW_2 10.7.0.3:80 check'])]),
328328
haproxy._config_backend_sections())
@@ -348,7 +348,7 @@ def test_config_backend_sections(self, mock_init, mock_details, mock_services, m
348348
'HW': [{'container_name': 'HW_1', 'proto': 'http', 'port': '80', 'addr': '10.7.0.2'},
349349
{'container_name': 'HW_2', 'proto': 'http', 'port': '80', 'addr': '10.7.0.3'}]}
350350
mock_vhosts.return_value = []
351-
self.assertEqual(OrderedDict([('backend default_service', ['BALANCE source',
351+
self.assertEqual(OrderedDict([('backend default_service', ['balance source',
352352
'server HW_1 10.7.0.2:80 check',
353353
'server HW_2 10.7.0.3:80 check'])]),
354354
haproxy._config_backend_sections())

tests/unit/test_parser.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def test_parse(self):
226226
env.parse("HELLO_ENV_NOT_DEFINED", "n/a")
227227
self.assertTrue("not_defined" not in env.details["HELLO"])
228228

229-
230229
env.parse("HW_ENV_DEFAULT_SSL_CERT", "cert")
231230
self.assertTrue("HW" not in env.details)
232231
env.parse("HELLO_ENV_DEFAULT_SSL_CERT", "cert")
@@ -285,8 +284,4 @@ def test_parse(self):
285284
self.assertEqual(["opt1", "opt2", "opt3"], env.details["HELLO"]["option"])
286285

287286
env.parse("HELLO_2_ENV_EXTRA_SETTINGS", "settings")
288-
self.assertEqual("settings", env.details["HELLO"]["extra_settings"])
289-
290-
# @staticmethod
291-
# def parse_extra_settings(value):
292-
# return value
287+
self.assertEqual("settings", env.details["HELLO"]["extra_settings"])

0 commit comments

Comments
 (0)