Commit eb33377c by Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend: Sort slave list during processing

This mostly useful during tests to have stable results, especially when
some slaves are rejected.

This change is expected to be no-op during normal run.

Note: The slave rejection system does not guarantee any ordering, as the sort
      order can change, because of parameters can reorder slaves. Thus, even
      if slave A was requested before slave B, and they conflict each other,
      slave A can be rejected instead of "expected" slave B.
1 parent 6f3eafe0
......@@ -26,7 +26,7 @@ md5sum = 55f607a1cc8059db76b3c9057435a5ab
[template-apache-replicate]
filename = instance-apache-replicate.cfg.in
md5sum = 81ad603fe0a1e29948bd81b457e8d7a4
md5sum = 0f5af15a0cc024ff181c15e946d92808
[template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
......
......@@ -75,7 +75,7 @@ context =
{% set warning_slave_dict = {} %}
{% set used_host_list = [] %}
{% set unauthorized_message = 'slave not authorized' %}
{% for slave in slave_instance_list %}
{% for slave in sorted(slave_instance_list) %}
{% set slave_error_list = [] %}
{% set slave_warning_list = [] %}
{% set slave_server_alias_unclashed = [] %}
......
......@@ -4192,7 +4192,7 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
'rejected-slave-amount': '3',
'slave-amount': '4',
'rejected-slave-dict': {
'_site_1': ["custom_domain 'duplicate.example.com' clashes"],
'_site_2': ["custom_domain 'duplicate.example.com' clashes"],
'_site_3': ["server-alias 'duplicate.example.com' clashes"],
'_site_4': ["custom_domain 'duplicate.example.com' clashes"]
}
......@@ -4205,15 +4205,6 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
def test_site_1(self):
parameter_dict = self.parseSlaveParameterDict('site_1')
self.assertEqual(
{
'request-error-list': ["custom_domain 'duplicate.example.com' clashes"]
},
parameter_dict
)
def test_site_2(self):
parameter_dict = self.parseSlaveParameterDict('site_2')
self.assertLogAccessUrlWithPop(parameter_dict)
self.assertKedifaKeysWithPop(parameter_dict)
self.assertEqual(
......@@ -4228,6 +4219,15 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict
)
def test_site_2(self):
parameter_dict = self.parseSlaveParameterDict('site_2')
self.assertEqual(
{
'request-error-list': ["custom_domain 'duplicate.example.com' clashes"]
},
parameter_dict
)
def test_site_3(self):
parameter_dict = self.parseSlaveParameterDict('site_3')
self.assertEqual(
......
......@@ -4,8 +4,8 @@ T-1/var/log/expose-csr_id.log
T-2/var/log/frontend-access.log
T-2/var/log/frontend-error.log
T-2/var/log/httpd-csr_id/expose-csr_id.log
T-2/var/log/httpd/_site_2_access_log
T-2/var/log/httpd/_site_2_error_log
T-2/var/log/httpd/_site_1_access_log
T-2/var/log/httpd/_site_1_error_log
T-2/var/log/monitor-httpd-error.log
T-2/var/log/nginx-access.log
T-2/var/log/nginx-error.log
......
......@@ -9,8 +9,8 @@ T-2/etc/plugin/caddy_frontend_ipv4_https.py: OK
T-2/etc/plugin/caddy_frontend_ipv6_http.py: OK
T-2/etc/plugin/caddy_frontend_ipv6_https.py: OK
T-2/etc/plugin/caddy_ssl_cached.py: ERROR
T-2/etc/plugin/check-_site_2-error-log-last-day.py: OK
T-2/etc/plugin/check-_site_2-error-log-last-hour.py: OK
T-2/etc/plugin/check-_site_1-error-log-last-day.py: OK
T-2/etc/plugin/check-_site_1-error-log-last-hour.py: OK
T-2/etc/plugin/check-free-disk-space.py: OK
T-2/etc/plugin/frontend-caddy-configuration-promise.py: OK
T-2/etc/plugin/monitor-bootstrap-status.py: OK
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!