Commit 77bc1c3d authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend/test: Test: Compare objects, not strings

parent 47f87a8b
...@@ -2,7 +2,6 @@ Generally things to be done with ``caddy-frontend``: ...@@ -2,7 +2,6 @@ Generally things to be done with ``caddy-frontend``:
* return warning on not implemented keys (from ``apache-frontend`` perspective) in master and slave request * return warning on not implemented keys (from ``apache-frontend`` perspective) in master and slave request
* tests: add assertion with results of promises in etc/promise for each partition * tests: add assertion with results of promises in etc/promise for each partition
* tests: compare python objects where possible instead of instead of strings (eg. load ``rejected-slave-dict``)
* tests: swich to `cryptography <https://pypi.org/project/cryptography/>`_ for certificate management * tests: swich to `cryptography <https://pypi.org/project/cryptography/>`_ for certificate management
* README: cleanup the documentation, explain various specifics * README: cleanup the documentation, explain various specifics
* check the whole frontend slave snippet with ``caddy -validate`` during buildout run, and reject if does not pass validation * check the whole frontend slave snippet with ``caddy -validate`` during buildout run, and reject if does not pass validation
......
...@@ -235,14 +235,10 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -235,14 +235,10 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
def assertLogAccessUrlWithPop(self, parameter_dict): def assertLogAccessUrlWithPop(self, parameter_dict):
log_access_url = parameter_dict.pop('log-access-url') log_access_url = parameter_dict.pop('log-access-url')
try:
log_access_url_json = json.loads(log_access_url)
except Exception:
raise ValueError('JSON decode problem in:\n%s' % (log_access_url,))
self.assertTrue(len(log_access_url_json) >= 1) self.assertTrue(len(log_access_url) >= 1)
# check only the first one, as second frontend will be stopped # check only the first one, as second frontend will be stopped
log_access = log_access_url_json[0] log_access = log_access_url[0]
entry = log_access.split(': ') entry = log_access.split(': ')
if len(entry) != 2: if len(entry) != 2:
self.fail('Cannot parse %r' % (log_access,)) self.fail('Cannot parse %r' % (log_access,))
...@@ -266,6 +262,22 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -266,6 +262,22 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
self.assertTrue(key in j, 'No key %r in %s' % (key, j)) self.assertTrue(key in j, 'No key %r in %s' % (key, j))
self.assertEqual(value, j[key]) self.assertEqual(value, j[key])
def parseParameterDict(self, parameter_dict):
parsed_parameter_dict = {}
for key, value in parameter_dict.items():
if key in [
'rejected-slave-dict',
'request-error-list',
'log-access-url']:
value = json.loads(value)
parsed_parameter_dict[key] = value
return parsed_parameter_dict
def parseConnectionParameterDict(self):
return self.parseParameterDict(
self.computer_partition.getConnectionParameterDict()
)
class TestMasterRequest(HttpFrontendTestCase, TestDataMixin): class TestMasterRequest(HttpFrontendTestCase, TestDataMixin):
@classmethod @classmethod
...@@ -279,7 +291,7 @@ class TestMasterRequest(HttpFrontendTestCase, TestDataMixin): ...@@ -279,7 +291,7 @@ class TestMasterRequest(HttpFrontendTestCase, TestDataMixin):
} }
def test(self): def test(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.parseConnectionParameterDict()
self.assertKeyWithPop('monitor-setup-url', parameter_dict) self.assertKeyWithPop('monitor-setup-url', parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -288,7 +300,7 @@ class TestMasterRequest(HttpFrontendTestCase, TestDataMixin): ...@@ -288,7 +300,7 @@ class TestMasterRequest(HttpFrontendTestCase, TestDataMixin):
'accepted-slave-amount': '0', 'accepted-slave-amount': '0',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
'slave-amount': '0', 'slave-amount': '0',
'rejected-slave-dict': '{}'}, 'rejected-slave-dict': {}},
parameter_dict parameter_dict
) )
...@@ -312,7 +324,7 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin): ...@@ -312,7 +324,7 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
} }
def test(self): def test(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.parseConnectionParameterDict()
self.assertKeyWithPop('monitor-setup-url', parameter_dict) self.assertKeyWithPop('monitor-setup-url', parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -322,7 +334,7 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin): ...@@ -322,7 +334,7 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
'accepted-slave-amount': '0', 'accepted-slave-amount': '0',
'rejected-slave-amount': '0', 'rejected-slave-amount': '0',
'slave-amount': '0', 'slave-amount': '0',
'rejected-slave-dict': '{}' 'rejected-slave-dict': {}
}, },
parameter_dict parameter_dict
) )
...@@ -489,6 +501,13 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase): ...@@ -489,6 +501,13 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
def tearDown(self): def tearDown(self):
self.unpatchRequests() self.unpatchRequests()
def parseSlaveParameterDict(self, key):
return self.parseParameterDict(
self.slave_connection_parameter_dict_dict[
key
]
)
class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
caddy_custom_https = '''# caddy_custom_https_filled_in_accepted caddy_custom_https = '''# caddy_custom_https_filled_in_accepted
...@@ -792,7 +811,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -792,7 +811,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
if os.path.exists(os.path.join(q, 'etc', 'trafficserver'))][0] if os.path.exists(os.path.join(q, 'etc', 'trafficserver'))][0]
def test_master_partition_state(self): def test_master_partition_state(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.parseConnectionParameterDict()
self.assertKeyWithPop('monitor-setup-url', parameter_dict) self.assertKeyWithPop('monitor-setup-url', parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
...@@ -801,12 +820,12 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -801,12 +820,12 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'accepted-slave-amount': '40', 'accepted-slave-amount': '40',
'rejected-slave-amount': '4', 'rejected-slave-amount': '4',
'slave-amount': '44', 'slave-amount': '44',
'rejected-slave-dict': 'rejected-slave-dict': {
'{"_apache_custom_http_s-rejected": ["slave not authorized"], ' "_apache_custom_http_s-rejected": ["slave not authorized"],
'"_caddy_custom_http_s": ["slave not authorized"], ' "_caddy_custom_http_s": ["slave not authorized"],
'"_caddy_custom_http_s-rejected": ["slave not authorized"], ' "_caddy_custom_http_s-rejected": ["slave not authorized"],
'"_ssl_ca_crt_only": ["ssl_ca_crt is present, so ssl_crt and ssl_key ' "_ssl_ca_crt_only": ["ssl_ca_crt is present, so ssl_crt and ssl_key "
'are required"]}' "are required"]}
} }
self.assertEqual( self.assertEqual(
...@@ -871,8 +890,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -871,8 +890,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_empty(self): def test_empty(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('empty')
'empty']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
parameter_dict, parameter_dict,
...@@ -933,8 +951,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -933,8 +951,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_url(self): def test_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('url')
'url'].copy()
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -995,8 +1013,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -995,8 +1013,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
@skip('Feature postponed') @skip('Feature postponed')
def test_url_ipv6_access(self): def test_url_ipv6_access(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('url')
'url'].copy()
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1026,8 +1043,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1026,8 +1043,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result_ipv6, 'Path', '/test-path') self.assertEqualResultJson(result_ipv6, 'Path', '/test-path')
def test_type_zope_path(self): def test_type_zope_path(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('type-zope-path')
'type-zope-path']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1056,8 +1072,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1056,8 +1072,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_zope_default_path(self): def test_type_zope_default_path(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('type-zope-default-path')
'type-zope-default-path']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1085,8 +1100,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1085,8 +1100,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_server_alias(self): def test_server_alias(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('server-alias')
'server-alias']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1126,8 +1140,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1126,8 +1140,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
der2pem(result.peercert)) der2pem(result.peercert))
def test_server_alias_wildcard(self): def test_server_alias_wildcard(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('server-alias-wildcard')
'server-alias-wildcard']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1160,8 +1173,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1160,8 +1173,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_server_alias_duplicated(self): def test_server_alias_duplicated(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('server-alias-duplicated')
'server-alias-duplicated']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1194,8 +1206,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1194,8 +1206,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_server_alias_custom_domain_duplicated(self): def test_server_alias_custom_domain_duplicated(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'server-alias_custom_domain-duplicated'] 'server-alias_custom_domain-duplicated')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1224,8 +1236,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1224,8 +1236,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
raise NotImplementedError(self.id()) raise NotImplementedError(self.id())
def test_ssl_ca_crt(self): def test_ssl_ca_crt(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'custom_domain_ssl_crt_ssl_key_ssl_ca_crt'] 'custom_domain_ssl_crt_ssl_key_ssl_ca_crt')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1250,18 +1262,16 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1250,18 +1262,16 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_ssl_ca_crt_only(self): def test_ssl_ca_crt_only(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('ssl_ca_crt_only')
'ssl_ca_crt_only']
self.assertEqual( self.assertEqual(
parameter_dict, parameter_dict,
{ {
'request-error-list': '["ssl_ca_crt is present, so ssl_crt and ' 'request-error-list': [
'ssl_key are required"]'} "ssl_ca_crt is present, so ssl_crt and ssl_key are required"]}
) )
def test_ssl_ca_crt_garbage(self): def test_ssl_ca_crt_garbage(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('ssl_ca_crt_garbage')
'ssl_ca_crt_garbage']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1286,8 +1296,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1286,8 +1296,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_ssl_ca_crt_does_not_match(self): def test_ssl_ca_crt_does_not_match(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('ssl_ca_crt_does_not_match')
'ssl_ca_crt_does_not_match']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1312,8 +1321,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1312,8 +1321,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_https_only(self): def test_https_only(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('https-only')
'https-only']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1345,8 +1353,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1345,8 +1353,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_custom_domain(self): def test_custom_domain(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('custom_domain')
'custom_domain']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1370,8 +1377,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1370,8 +1377,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_custom_domain_wildcard(self): def test_custom_domain_wildcard(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('custom_domain_wildcard')
'custom_domain_wildcard']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1396,8 +1402,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1396,8 +1402,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_custom_domain_ssl_crt_ssl_key(self): def test_custom_domain_ssl_crt_ssl_key(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'custom_domain_ssl_crt_ssl_key'] 'custom_domain_ssl_crt_ssl_key')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1421,8 +1427,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1421,8 +1427,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_type_zope(self): def test_type_zope(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('type-zope')
'type-zope']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1467,8 +1472,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1467,8 +1472,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_zope_virtualhostroot_http_port(self): def test_type_zope_virtualhostroot_http_port(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'type-zope-virtualhostroot-http-port'] 'type-zope-virtualhostroot-http-port')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1494,8 +1499,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1494,8 +1499,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_zope_virtualhostroot_https_port(self): def test_type_zope_virtualhostroot_https_port(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'type-zope-virtualhostroot-https-port'] 'type-zope-virtualhostroot-https-port')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1525,8 +1530,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1525,8 +1530,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_notebook(self): def test_type_notebook(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('type-notebook')
'type-notebook']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1567,8 +1571,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1567,8 +1571,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
# Caddy as a proxy in front of nginx-push-stream . If we have a # Caddy as a proxy in front of nginx-push-stream . If we have a
# "central shared" caddy instance, can it handle keeping connections # "central shared" caddy instance, can it handle keeping connections
# opens for many clients ? # opens for many clients ?
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('type-eventsource')
'type-eventsource']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1609,8 +1612,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1609,8 +1612,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_redirect(self): def test_type_redirect(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('type-redirect')
'type-redirect']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1637,8 +1639,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1637,8 +1639,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_ssl_proxy_verify_ssl_proxy_ca_crt(self): def test_ssl_proxy_verify_ssl_proxy_ca_crt(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'ssl-proxy-verify_ssl_proxy_ca_crt'] 'ssl-proxy-verify_ssl_proxy_ca_crt')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -1674,8 +1676,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1674,8 +1676,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_ssl_proxy_verify_unverified(self): def test_ssl_proxy_verify_unverified(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'ssl-proxy-verify-unverified'] 'ssl-proxy-verify-unverified')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -1703,8 +1705,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1703,8 +1705,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_enable_cache_ssl_proxy_verify_ssl_proxy_ca_crt(self): def test_enable_cache_ssl_proxy_verify_ssl_proxy_ca_crt(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt'] 'enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -1742,8 +1744,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1742,8 +1744,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_enable_cache_ssl_proxy_verify_unverified(self): def test_enable_cache_ssl_proxy_verify_unverified(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'enable_cache-ssl-proxy-verify-unverified'] 'enable_cache-ssl-proxy-verify-unverified')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -1772,8 +1774,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1772,8 +1774,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_zope_ssl_proxy_verify_ssl_proxy_ca_crt(self): def test_type_zope_ssl_proxy_verify_ssl_proxy_ca_crt(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'type-zope-ssl-proxy-verify_ssl_proxy_ca_crt'] 'type-zope-ssl-proxy-verify_ssl_proxy_ca_crt')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -1810,8 +1812,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1810,8 +1812,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_type_zope_ssl_proxy_verify_unverified(self): def test_type_zope_ssl_proxy_verify_unverified(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'type-zope-ssl-proxy-verify-unverified'] 'type-zope-ssl-proxy-verify-unverified')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
...@@ -1840,8 +1842,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1840,8 +1842,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_monitor_ipv6_test(self): def test_monitor_ipv6_test(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('monitor-ipv6-test')
'monitor-ipv6-test']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1883,8 +1884,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1883,8 +1884,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_monitor_ipv4_test(self): def test_monitor_ipv4_test(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('monitor-ipv4-test')
'monitor-ipv4-test']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1926,8 +1926,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1926,8 +1926,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_re6st_optimal_test(self): def test_re6st_optimal_test(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('re6st-optimal-test')
're6st-optimal-test']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -1970,8 +1969,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1970,8 +1969,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_enable_cache(self): def test_enable_cache(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable_cache')
'enable_cache']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2061,8 +2059,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2061,8 +2059,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_enable_cache_disable_no_cache_request(self): def test_enable_cache_disable_no_cache_request(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'enable_cache-disable-no-cache-request'] 'enable_cache-disable-no-cache-request')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2114,8 +2112,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2114,8 +2112,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertFalse('pragma' in j['Incoming Headers'].keys()) self.assertFalse('pragma' in j['Incoming Headers'].keys())
def test_enable_cache_disable_via_header(self): def test_enable_cache_disable_via_header(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'enable_cache-disable-via-header'] 'enable_cache-disable-via-header')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2159,8 +2157,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2159,8 +2157,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
) )
def test_enable_http2_false(self): def test_enable_http2_false(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-false')
'enable-http2-false']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2209,8 +2206,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2209,8 +2206,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4'])) isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4']))
def test_enable_http2_default(self): def test_enable_http2_default(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-default')
'enable-http2-default']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2259,8 +2255,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2259,8 +2255,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4'])) isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4']))
def test_prefer_gzip_encoding_to_backend(self): def test_prefer_gzip_encoding_to_backend(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'prefer-gzip-encoding-to-backend'] 'prefer-gzip-encoding-to-backend')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2298,8 +2294,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2298,8 +2294,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'deflate', result.json()['Incoming Headers']['accept-encoding']) 'deflate', result.json()['Incoming Headers']['accept-encoding'])
def test_disabled_cookie_list(self): def test_disabled_cookie_list(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('disabled-cookie-list')
'disabled-cookie-list']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2331,11 +2326,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2331,11 +2326,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'Coffee=present', result.json()['Incoming Headers']['cookie']) 'Coffee=present', result.json()['Incoming Headers']['cookie'])
def test_apache_custom_http_s_rejected(self): def test_apache_custom_http_s_rejected(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'apache_custom_http_s-rejected'] 'apache_custom_http_s-rejected')
self.assertEqual( self.assertEqual(
{ {
'request-error-list': '["slave not authorized"]' 'request-error-list': ["slave not authorized"]
}, },
parameter_dict) parameter_dict)
slave_configuration_file_list = glob.glob(os.path.join( slave_configuration_file_list = glob.glob(os.path.join(
...@@ -2352,8 +2347,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2352,8 +2347,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual([], configuration_file_with_custom_http_list) self.assertEqual([], configuration_file_with_custom_http_list)
def test_apache_custom_http_s_accepted(self): def test_apache_custom_http_s_accepted(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'apache_custom_http_s-accepted'] 'apache_custom_http_s-accepted')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{'replication_number': '1', 'public-ipv4': LOCAL_IPV4}, {'replication_number': '1', 'public-ipv4': LOCAL_IPV4},
...@@ -2408,11 +2403,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2408,11 +2403,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual(1, len(configuration_file_with_custom_http_list)) self.assertEqual(1, len(configuration_file_with_custom_http_list))
def test_caddy_custom_http_s_rejected(self): def test_caddy_custom_http_s_rejected(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'caddy_custom_http_s-rejected'] 'caddy_custom_http_s-rejected')
self.assertEqual( self.assertEqual(
{ {
'request-error-list': '["slave not authorized"]' 'request-error-list': ["slave not authorized"]
}, },
parameter_dict) parameter_dict)
slave_configuration_file_list = glob.glob(os.path.join( slave_configuration_file_list = glob.glob(os.path.join(
...@@ -2429,11 +2424,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2429,11 +2424,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual([], configuration_file_with_custom_http_list) self.assertEqual([], configuration_file_with_custom_http_list)
def test_caddy_custom_http_s(self): def test_caddy_custom_http_s(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'caddy_custom_http_s'] 'caddy_custom_http_s')
self.assertEqual( self.assertEqual(
{ {
'request-error-list': '["slave not authorized"]' 'request-error-list': ["slave not authorized"]
}, },
parameter_dict) parameter_dict)
slave_configuration_file_list = glob.glob(os.path.join( slave_configuration_file_list = glob.glob(os.path.join(
...@@ -2450,8 +2445,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2450,8 +2445,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual([], configuration_file_with_custom_http_list) self.assertEqual([], configuration_file_with_custom_http_list)
def test_caddy_custom_http_s_accepted(self): def test_caddy_custom_http_s_accepted(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'caddy_custom_http_s-accepted'] 'caddy_custom_http_s-accepted')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{'replication_number': '1', 'public-ipv4': LOCAL_IPV4}, {'replication_number': '1', 'public-ipv4': LOCAL_IPV4},
...@@ -2506,8 +2501,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2506,8 +2501,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual(1, len(configuration_file_with_custom_http_list)) self.assertEqual(1, len(configuration_file_with_custom_http_list))
def test_https_url(self): def test_https_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('url_https-url')
'url_https-url']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2565,8 +2559,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -2565,8 +2559,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin):
} }
def test(self): def test(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('replicate')
'replicate']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2639,8 +2632,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase, ...@@ -2639,8 +2632,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
} }
def test_enable_http2_default(self): def test_enable_http2_default(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-default')
'enable-http2-default']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2659,8 +2651,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase, ...@@ -2659,8 +2651,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4'])) isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4']))
def test_enable_http2_false(self): def test_enable_http2_false(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-false')
'enable-http2-false']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2679,8 +2670,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase, ...@@ -2679,8 +2670,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4'])) isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4']))
def test_enable_http2_true(self): def test_enable_http2_true(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-true')
'enable-http2-true']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2731,8 +2721,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase, ...@@ -2731,8 +2721,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
} }
def test_enable_http2_default(self): def test_enable_http2_default(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-default')
'enable-http2-default']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2751,8 +2740,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase, ...@@ -2751,8 +2740,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4'])) isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4']))
def test_enable_http2_false(self): def test_enable_http2_false(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-false')
'enable-http2-false']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2771,8 +2759,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase, ...@@ -2771,8 +2759,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4'])) isHTTP2(parameter_dict['domain'], parameter_dict['public-ipv4']))
def test_enable_http2_true(self): def test_enable_http2_true(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('enable-http2-true')
'enable-http2-true']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2812,8 +2799,7 @@ class TestRe6stVerificationUrlDefaultSlave(SlaveHttpFrontendTestCase, ...@@ -2812,8 +2799,7 @@ class TestRe6stVerificationUrlDefaultSlave(SlaveHttpFrontendTestCase,
} }
def test_default(self): def test_default(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('default')
'default']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2862,8 +2848,7 @@ class TestRe6stVerificationUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2862,8 +2848,7 @@ class TestRe6stVerificationUrlSlave(SlaveHttpFrontendTestCase,
} }
def test_default(self): def test_default(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('default')
'default']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2922,7 +2907,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2922,7 +2907,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
} }
def test_master_partition_state(self): def test_master_partition_state(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.parseConnectionParameterDict()
self.assertKeyWithPop('monitor-setup-url', parameter_dict) self.assertKeyWithPop('monitor-setup-url', parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
...@@ -2931,10 +2916,11 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2931,10 +2916,11 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
'accepted-slave-amount': '1', 'accepted-slave-amount': '1',
'rejected-slave-amount': '2', 'rejected-slave-amount': '2',
'slave-amount': '3', 'slave-amount': '3',
'rejected-slave-dict': 'rejected-slave-dict': {
'{"_https-url": ["slave https-url \\"https://[fd46::c2ae]:!py!u\'123123' '_https-url': ['slave https-url "https://[fd46::c2ae]:!py!u\'123123\'"'
'\'\\" invalid"], "_url": ["slave url \\"https://[fd46::c2ae]:!py!u\'' ' invalid'],
'123123\'\\" invalid"]}' '_url': [u'slave url "https://[fd46::c2ae]:!py!u\'123123\'" invalid']
}
} }
self.assertEqual( self.assertEqual(
...@@ -2943,8 +2929,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2943,8 +2929,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
) )
def test_empty(self): def test_empty(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('empty')
'empty']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -2968,23 +2953,21 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2968,23 +2953,21 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
self.assertEqual(httplib.NOT_FOUND, result.status_code) self.assertEqual(httplib.NOT_FOUND, result.status_code)
def test_url(self): def test_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('url')
'url'].copy()
self.assertEqual( self.assertEqual(
{ {
'request-error-list': '["slave url \\"https://[fd46::c2ae]:!py!' 'request-error-list': [
'u\'123123\'\\" invalid"]' "slave url \"https://[fd46::c2ae]:!py!u'123123'\" invalid"]
}, },
parameter_dict parameter_dict
) )
def test_https_url(self): def test_https_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('https-url')
'https-url'].copy()
self.assertEqual( self.assertEqual(
{ {
'request-error-list': '["slave https-url \\"https://[fd46::c2ae]:' 'request-error-list': [
'!py!u\'123123\'\\" invalid"]' "slave https-url \"https://[fd46::c2ae]:!py!u'123123'\" invalid"]
}, },
parameter_dict parameter_dict
) )
...@@ -3006,8 +2989,7 @@ class TestDefaultMonitorHttpdPort(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3006,8 +2989,7 @@ class TestDefaultMonitorHttpdPort(SlaveHttpFrontendTestCase, TestDataMixin):
} }
def test(self): def test(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('test')
'test']
self.assertKeyWithPop('log-access-url', parameter_dict) self.assertKeyWithPop('log-access-url', parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3073,8 +3055,7 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3073,8 +3055,7 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin):
if os.path.exists(os.path.join(q, 'etc', 'trafficserver'))][0] if os.path.exists(os.path.join(q, 'etc', 'trafficserver'))][0]
def test_url(self): def test_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('url')
'url'].copy()
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3214,7 +3195,7 @@ https://www.google.com {}""", ...@@ -3214,7 +3195,7 @@ https://www.google.com {}""",
} }
def test_master_partition_state(self): def test_master_partition_state(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.parseConnectionParameterDict()
self.assertKeyWithPop('monitor-setup-url', parameter_dict) self.assertKeyWithPop('monitor-setup-url', parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
...@@ -3223,14 +3204,21 @@ https://www.google.com {}""", ...@@ -3223,14 +3204,21 @@ https://www.google.com {}""",
'accepted-slave-amount': '8', 'accepted-slave-amount': '8',
'rejected-slave-amount': '4', 'rejected-slave-amount': '4',
'slave-amount': '12', 'slave-amount': '12',
'rejected-slave-dict': 'rejected-slave-dict': {
'{"_caddy_custom_http_s-reject": ["slave caddy_custom_http ' '_caddy_custom_http_s-reject': [
'configuration invalid", "slave caddy_custom_https configuration ' 'slave caddy_custom_http configuration invalid',
'invalid"], "_server-alias-unsafe": ["server-alias \'${section:option}\'' 'slave caddy_custom_https configuration invalid'],
' not valid", "server-alias \'afterspace\' not valid"], ' '_custom_domain-unsafe': [
'"_custom_domain-unsafe": ["custom_domain \'${section:option} ' "custom_domain '${section:option} afterspace\\nafternewline' invalid"
'afterspace\\\\nafternewline\' invalid"], "_ssl_key-ssl_crt-unsafe": ' ],
'["slave ssl_key and ssl_crt does not match"]}' '_server-alias-unsafe': [
"server-alias '${section:option}' not valid",
"server-alias 'afterspace' not valid"
],
'_ssl_key-ssl_crt-unsafe': [
'slave ssl_key and ssl_crt does not match'
]
}
} }
self.assertEqual( self.assertEqual(
...@@ -3239,8 +3227,7 @@ https://www.google.com {}""", ...@@ -3239,8 +3227,7 @@ https://www.google.com {}""",
) )
def test_server_alias_same(self): def test_server_alias_same(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('server-alias-same')
'server-alias-same']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3264,8 +3251,7 @@ https://www.google.com {}""", ...@@ -3264,8 +3251,7 @@ https://www.google.com {}""",
self.assertEqualResultJson(result, 'Path', '/test-path') self.assertEqualResultJson(result, 'Path', '/test-path')
def test_re6st_optimal_test_unsafe(self): def test_re6st_optimal_test_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('re6st-optimal-test-unsafe')
're6st-optimal-test-unsafe']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3308,8 +3294,7 @@ https://www.google.com {}""", ...@@ -3308,8 +3294,7 @@ https://www.google.com {}""",
) )
def test_re6st_optimal_test_nocomma(self): def test_re6st_optimal_test_nocomma(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('re6st-optimal-test-nocomma')
're6st-optimal-test-nocomma']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3343,32 +3328,30 @@ https://www.google.com {}""", ...@@ -3343,32 +3328,30 @@ https://www.google.com {}""",
) )
def test_custom_domain_unsafe(self): def test_custom_domain_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('custom_domain-unsafe')
'custom_domain-unsafe']
self.assertEqual( self.assertEqual(
{ {
'request-error-list': 'request-error-list': [
'["custom_domain \'${section:option} afterspace\\\\nafternewline\' ' "custom_domain \'${section:option} afterspace\\\\nafternewline\' "
'invalid"]' "invalid"]
}, },
parameter_dict parameter_dict
) )
def test_server_alias_unsafe(self): def test_server_alias_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('server-alias-unsafe')
'server-alias-unsafe']
self.assertEqual( self.assertEqual(
{ {
'request-error-list': 'request-error-list': [
'["server-alias \'${section:option}\' not valid", "server-alias ' "server-alias '${section:option}' not valid", "server-alias "
'\'afterspace\' not valid"]' "'afterspace' not valid"]
}, },
parameter_dict parameter_dict
) )
def test_virtualhostroot_http_port_unsafe(self): def test_virtualhostroot_http_port_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'virtualhostroot-http-port-unsafe'] 'virtualhostroot-http-port-unsafe')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3394,8 +3377,8 @@ https://www.google.com {}""", ...@@ -3394,8 +3377,8 @@ https://www.google.com {}""",
) )
def test_virtualhostroot_https_port_unsafe(self): def test_virtualhostroot_https_port_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict(
'virtualhostroot-https-port-unsafe'] 'virtualhostroot-https-port-unsafe')
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3425,8 +3408,7 @@ https://www.google.com {}""", ...@@ -3425,8 +3408,7 @@ https://www.google.com {}""",
) )
def default_path_unsafe(self): def default_path_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('default-path-unsafe')
'default-path-unsafe']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3454,8 +3436,7 @@ https://www.google.com {}""", ...@@ -3454,8 +3436,7 @@ https://www.google.com {}""",
) )
def test_monitor_ipv4_test_unsafe(self): def test_monitor_ipv4_test_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('monitor-ipv4-test-unsafe')
'monitor-ipv4-test-unsafe']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3497,8 +3478,7 @@ https://www.google.com {}""", ...@@ -3497,8 +3478,7 @@ https://www.google.com {}""",
) )
def test_monitor_ipv6_test_unsafe(self): def test_monitor_ipv6_test_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('monitor-ipv6-test-unsafe')
'monitor-ipv6-test-unsafe']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3540,21 +3520,20 @@ https://www.google.com {}""", ...@@ -3540,21 +3520,20 @@ https://www.google.com {}""",
) )
def test_ssl_key_ssl_crt_unsafe(self): def test_ssl_key_ssl_crt_unsafe(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('ssl_key-ssl_crt-unsafe')
'ssl_key-ssl_crt-unsafe']
self.assertEqual( self.assertEqual(
{'request-error-list': '["slave ssl_key and ssl_crt does not match"]'}, {'request-error-list': ["slave ssl_key and ssl_crt does not match"]},
parameter_dict parameter_dict
) )
def test_caddy_custom_http_s_reject(self): def test_caddy_custom_http_s_reject(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('caddy_custom_http_s-reject')
'caddy_custom_http_s-reject']
self.assertEqual( self.assertEqual(
{ {
'request-error-list': 'request-error-list': [
'["slave caddy_custom_http configuration invalid", ' "slave caddy_custom_http configuration invalid",
'"slave caddy_custom_https configuration invalid"]' "slave caddy_custom_https configuration invalid"
]
}, },
parameter_dict parameter_dict
) )
...@@ -3598,7 +3577,7 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3598,7 +3577,7 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
} }
def test_master_partition_state(self): def test_master_partition_state(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.parseConnectionParameterDict()
self.assertKeyWithPop('monitor-setup-url', parameter_dict) self.assertKeyWithPop('monitor-setup-url', parameter_dict)
expected_parameter_dict = { expected_parameter_dict = {
...@@ -3607,10 +3586,11 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3607,10 +3586,11 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
'accepted-slave-amount': '1', 'accepted-slave-amount': '1',
'rejected-slave-amount': '3', 'rejected-slave-amount': '3',
'slave-amount': '4', 'slave-amount': '4',
'rejected-slave-dict': 'rejected-slave-dict': {
'{"_site_4": ["custom_domain \'duplicate.example.com\' clashes"], ' '_site_1': ["custom_domain 'duplicate.example.com' clashes"],
'"_site_1": ["custom_domain \'duplicate.example.com\' clashes"], ' '_site_3': ["server-alias 'duplicate.example.com' clashes"],
'"_site_3": ["server-alias \'duplicate.example.com\' clashes"]}' '_site_4': ["custom_domain 'duplicate.example.com' clashes"]
}
} }
self.assertEqual( self.assertEqual(
...@@ -3619,19 +3599,16 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3619,19 +3599,16 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
) )
def test_site_1(self): def test_site_1(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('site_1')
'site_1']
self.assertEqual( self.assertEqual(
{ {
'request-error-list': 'request-error-list': ["custom_domain 'duplicate.example.com' clashes"]
'["custom_domain \'duplicate.example.com\' clashes"]'
}, },
parameter_dict parameter_dict
) )
def test_site_2(self): def test_site_2(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('site_2')
'site_2']
self.assertLogAccessUrlWithPop(parameter_dict) self.assertLogAccessUrlWithPop(parameter_dict)
self.assertEqual( self.assertEqual(
{ {
...@@ -3646,23 +3623,19 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3646,23 +3623,19 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
) )
def test_site_3(self): def test_site_3(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('site_3')
'site_3']
self.assertEqual( self.assertEqual(
{ {
'request-error-list': 'request-error-list': ["server-alias 'duplicate.example.com' clashes"]
'["server-alias \'duplicate.example.com\' clashes"]'
}, },
parameter_dict, parameter_dict,
) )
def test_site_4(self): def test_site_4(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.parseSlaveParameterDict('site_4')
'site_4']
self.assertEqual( self.assertEqual(
{ {
'request-error-list': 'request-error-list': ["custom_domain 'duplicate.example.com' clashes"]
'["custom_domain \'duplicate.example.com\' clashes"]'
}, },
parameter_dict parameter_dict
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment