Commit 482463e4 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Use health-check name

backend-active-check is really long and technical name, whereas health-check
is well known description of backend checks.
parent 1593304e
...@@ -239,14 +239,14 @@ Necessary to activate cache. ...@@ -239,14 +239,14 @@ Necessary to activate cache.
``enable_cache`` is an optional parameter. ``enable_cache`` is an optional parameter.
backend-active-check-* health-check-*
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
This set of parameters is used to control the way how the backend checks will be done. Such active checks can be really useful for `stale-if-error` caching technique and especially in case if backend is very slow to reply or to connect to. This set of parameters is used to control the way how the backend checks will be done. Such active checks can be really useful for `stale-if-error` caching technique and especially in case if backend is very slow to reply or to connect to.
`backend-active-check-http-method` can be used to configure the HTTP method used to check the backend. Special method `CONNECT` can be used to check only for connection attempt. `health-check-http-method` can be used to configure the HTTP method used to check the backend. Special method `CONNECT` can be used to check only for connection attempt.
Please be aware that the `backend-active-check-timeout` is really short by default, so in case if `/` of the backend is slow to reply configure proper path with `backend-active-check-http-path` to not mark such backend down too fast, before increasing the check timeout. Please be aware that the `health-check-timeout` is really short by default, so in case if `/` of the backend is slow to reply configure proper path with `health-check-http-path` to not mark such backend down too fast, before increasing the check timeout.
Examples Examples
======== ========
......
...@@ -26,11 +26,11 @@ md5sum = a6a626fd1579fd1d4b80ea67433ca16a ...@@ -26,11 +26,11 @@ md5sum = a6a626fd1579fd1d4b80ea67433ca16a
[profile-caddy-replicate] [profile-caddy-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
md5sum = 7cb8157d2b368ab3b281ea42f743eb9c md5sum = 9cc78e7ce1960691e37f103855ff0dc9
[profile-slave-list] [profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in _update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
md5sum = 5f2c1f3f8eebc8f3453c223b30459722 md5sum = eb98ffd96b2768cc6a5cf664b23aabd3
[profile-replicate-publish-slave-information] [profile-replicate-publish-slave-information]
_update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in _update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in
...@@ -50,7 +50,7 @@ md5sum = a0ae858a3db8825c22d33d323392f588 ...@@ -50,7 +50,7 @@ md5sum = a0ae858a3db8825c22d33d323392f588
[template-backend-haproxy-configuration] [template-backend-haproxy-configuration]
_update_hash_filename_ = templates/backend-haproxy.cfg.in _update_hash_filename_ = templates/backend-haproxy.cfg.in
md5sum = d86ae2fcf89deaa08d791da12d5897e4 md5sum = b9b56e0018bfbfa5b6c2640f95e6f750
[template-empty] [template-empty]
_update_hash_filename_ = templates/empty.in _update_hash_filename_ = templates/empty.in
......
...@@ -123,33 +123,33 @@ context = ...@@ -123,33 +123,33 @@ context =
{% elif slave_type not in [None, '', 'default', 'zope', 'redirect', 'notebook', 'websocket'] %} {% elif slave_type not in [None, '', 'default', 'zope', 'redirect', 'notebook', 'websocket'] %}
{% do slave_error_list.append('type:%s is not supported' % (slave_type,)) %} {% do slave_error_list.append('type:%s is not supported' % (slave_type,)) %}
{% endif %} {% endif %}
{# Check backend-active-check-* #} {# Check health-check-* #}
{% set backend_active_check = (str(slave.get('backend-active-check', False)) or 'false').lower() %} {% set health_check = (str(slave.get('health-check', False)) or 'false').lower() %}
{% if backend_active_check in TRUE_VALUES %} {% if health_check in TRUE_VALUES %}
{% set backend_active_check_http_method = slave.get('backend-active-check-http-method') or 'GET' %} {% set health_check_http_method = slave.get('health-check-http-method') or 'GET' %}
{% if backend_active_check_http_method not in ['GET', 'OPTIONS', 'CONNECT', 'POST'] %} {% if health_check_http_method not in ['GET', 'OPTIONS', 'CONNECT', 'POST'] %}
{% do slave_error_list.append('Wrong backend-active-check-http-method %s' % (backend_active_check_http_method,)) %} {% do slave_error_list.append('Wrong health-check-http-method %s' % (health_check_http_method,)) %}
{% endif %} {% endif %}
{% set backend_active_check_http_path = slave.get('backend-active-check-http-path') or '/' %} {% set health_check_http_path = slave.get('health-check-http-path') or '/' %}
{% set backend_active_check_http_version = slave.get('backend-active-check-http-version') or 'HTTP/1.1' %} {% set health_check_http_version = slave.get('health-check-http-version') or 'HTTP/1.1' %}
{% if backend_active_check_http_version not in ['HTTP/1.1', 'HTTP/1.0'] %} {% if health_check_http_version not in ['HTTP/1.1', 'HTTP/1.0'] %}
{% do slave_error_list.append('Wrong backend-active-check-http-version %s' % (backend_active_check_http_version,)) %} {% do slave_error_list.append('Wrong health-check-http-version %s' % (health_check_http_version,)) %}
{% endif %} {% endif %}
{% set backend_active_check_timeout = (slave.get('backend-active-check-timeout') or '2') | int(false) %} {% set health_check_timeout = (slave.get('health-check-timeout') or '2') | int(false) %}
{% if backend_active_check_timeout is false or backend_active_check_timeout <= 0 %} {% if health_check_timeout is false or health_check_timeout <= 0 %}
{% do slave_error_list.append('Wrong backend-active-check-timeout %s' % (slave.get('backend-active-check-timeout'),)) %} {% do slave_error_list.append('Wrong health-check-timeout %s' % (slave.get('health-check-timeout'),)) %}
{% endif %} {% endif %}
{% set backend_active_check_interval = (slave.get('backend-active-check-interval') or '5') | int(false) %} {% set health_check_interval = (slave.get('health-check-interval') or '5') | int(false) %}
{% if backend_active_check_interval is false or backend_active_check_interval <= 0 %} {% if health_check_interval is false or health_check_interval <= 0 %}
{% do slave_error_list.append('Wrong backend-active-check-interval %s' % (slave.get('backend-active-check-interval'),)) %} {% do slave_error_list.append('Wrong health-check-interval %s' % (slave.get('health-check-interval'),)) %}
{% endif %} {% endif %}
{% set backend_active_check_rise = (slave.get('backend-active-check-rise') or '1') | int(false) %} {% set health_check_rise = (slave.get('health-check-rise') or '1') | int(false) %}
{% if backend_active_check_rise is false or backend_active_check_rise <= 0 %} {% if health_check_rise is false or health_check_rise <= 0 %}
{% do slave_error_list.append('Wrong backend-active-check-rise %s' % (slave.get('backend-active-check-rise'),)) %} {% do slave_error_list.append('Wrong health-check-rise %s' % (slave.get('health-check-rise'),)) %}
{% endif %} {% endif %}
{% set backend_active_check_fall = (slave.get('backend-active-check-fall') or '1') | int(false) %} {% set health_check_fall = (slave.get('health-check-fall') or '1') | int(false) %}
{% if backend_active_check_fall is false or backend_active_check_fall <= 0 %} {% if health_check_fall is false or health_check_fall <= 0 %}
{% do slave_error_list.append('Wrong backend-active-check-fall %s' % (slave.get('backend-active-check-fall'),)) %} {% do slave_error_list.append('Wrong health-check-fall %s' % (slave.get('health-check-fall'),)) %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{# Check virtualhostroot-http-port and virtualhostroot-https-port #} {# Check virtualhostroot-http-port and virtualhostroot-https-port #}
......
...@@ -224,8 +224,8 @@ ...@@ -224,8 +224,8 @@
"title": "Authenticate to backend", "title": "Authenticate to backend",
"type": "string" "type": "string"
}, },
"backend-active-check": { "health-check": {
"title": "Backend Active Check", "title": "Health Check",
"description": "Enables active checks of the backend. For HTTP level checks the HTTP code shall be 2xx or 3xx, otherwise backend will be considered down.", "description": "Enables active checks of the backend. For HTTP level checks the HTTP code shall be 2xx or 3xx, otherwise backend will be considered down.",
"enum": [ "enum": [
"false", "false",
...@@ -234,8 +234,8 @@ ...@@ -234,8 +234,8 @@
"default": "false", "default": "false",
"type": "string" "type": "string"
}, },
"backend-active-check-http-method": { "health-check-http-method": {
"title": "Backend Active Check HTTP Metod", "title": "Health Check HTTP Metod",
"description": "Selects method to do the active check. CONNECT means that connection will be enough for the check, otherwise it's HTTP method.", "description": "Selects method to do the active check. CONNECT means that connection will be enough for the check, otherwise it's HTTP method.",
"enum": [ "enum": [
"GET", "GET",
...@@ -246,14 +246,14 @@ ...@@ -246,14 +246,14 @@
"default": "GET", "default": "GET",
"type": "string" "type": "string"
}, },
"backend-active-check-http-path": { "health-check-http-path": {
"title": "Backend Active Check HTTP Path", "title": "Health Check HTTP Path",
"description": "A path on which do the active check, unused in case of CONNECT.", "description": "A path on which do the active check, unused in case of CONNECT.",
"default": "/", "default": "/",
"type": "string" "type": "string"
}, },
"backend-active-check-http-version": { "health-check-http-version": {
"title": "Backend Active Check HTTP Version", "title": "Health Check HTTP Version",
"description": "A HTTP version to use to check the backend, unused in case of CONNECT.", "description": "A HTTP version to use to check the backend, unused in case of CONNECT.",
"enum": [ "enum": [
"HTTP/1.1", "HTTP/1.1",
...@@ -262,26 +262,26 @@ ...@@ -262,26 +262,26 @@
"default": "HTTP/1.1", "default": "HTTP/1.1",
"type": "string" "type": "string"
}, },
"backend-active-check-timeout": { "health-check-timeout": {
"title": "Backend Active Check Timeout (seconds)", "title": "Health Check Timeout (seconds)",
"description": "A timeout to for the request to be fulfilled, after connection happen.", "description": "A timeout to for the request to be fulfilled, after connection happen.",
"default": "2", "default": "2",
"type": "integer" "type": "integer"
}, },
"backend-active-check-interval": { "health-check-interval": {
"title": "Backend Active Check Interval (seconds)", "title": "Health Check Interval (seconds)",
"description": "An interval of backend active check.", "description": "An interval of health check.",
"default": "5", "default": "5",
"type": "integer" "type": "integer"
}, },
"backend-active-check-rise": { "health-check-rise": {
"title": "Backend Active Check Rise", "title": "Health Check Rise",
"description": "Amount of correct responses from the backend to consider it up.", "description": "Amount of correct responses from the backend to consider it up.",
"default": "1", "default": "1",
"type": "integer" "type": "integer"
}, },
"backend-active-check-fall": { "health-check-fall": {
"title": "Backend Active Check Fall", "title": "Health Check Fall",
"description": "Amount of bad responses from the backend to consider it down.", "description": "Amount of bad responses from the backend to consider it down.",
"default": "1", "default": "1",
"type": "integer" "type": "integer"
......
...@@ -136,32 +136,32 @@ context = ...@@ -136,32 +136,32 @@ context =
{%- do slave_instance.__setitem__('strict-transport-security', int(slave_instance['strict-transport-security'])) %} {%- do slave_instance.__setitem__('strict-transport-security', int(slave_instance['strict-transport-security'])) %}
{%- do slave_instance.__setitem__('authenticate-to-backend', ('' ~ slave_instance.get('authenticate-to-backend', '')).lower() in TRUE_VALUES) %} {%- do slave_instance.__setitem__('authenticate-to-backend', ('' ~ slave_instance.get('authenticate-to-backend', '')).lower() in TRUE_VALUES) %}
{#- Setup active check #} {#- Setup active check #}
{%- do slave_instance.__setitem__('backend-active-check', ('' ~ slave_instance.get('backend-active-check', '')).lower() in TRUE_VALUES) %} {%- do slave_instance.__setitem__('health-check', ('' ~ slave_instance.get('health-check', '')).lower() in TRUE_VALUES) %}
{%- if slave_instance['backend-active-check'] %} {%- if slave_instance['health-check'] %}
{%- if 'backend-active-check-http-method' not in slave_instance %} {%- if 'health-check-http-method' not in slave_instance %}
{%- do slave_instance.__setitem__('backend-active-check-http-method', 'GET') %} {%- do slave_instance.__setitem__('health-check-http-method', 'GET') %}
{%- endif %} {%- endif %}
{%- if 'backend-active-check-http-version' not in slave_instance %} {%- if 'health-check-http-version' not in slave_instance %}
{%- do slave_instance.__setitem__('backend-active-check-http-version', 'HTTP/1.1') %} {%- do slave_instance.__setitem__('health-check-http-version', 'HTTP/1.1') %}
{%- endif %} {%- endif %}
{%- if 'backend-active-check-interval' not in slave_instance %} {%- if 'health-check-interval' not in slave_instance %}
{%- do slave_instance.__setitem__('backend-active-check-interval', '5') %} {%- do slave_instance.__setitem__('health-check-interval', '5') %}
{%- endif %} {%- endif %}
{%- if 'backend-active-check-rise' not in slave_instance %} {%- if 'health-check-rise' not in slave_instance %}
{%- do slave_instance.__setitem__('backend-active-check-rise', '1') %} {%- do slave_instance.__setitem__('health-check-rise', '1') %}
{%- endif %} {%- endif %}
{%- if 'backend-active-check-fall' not in slave_instance %} {%- if 'health-check-fall' not in slave_instance %}
{%- do slave_instance.__setitem__('backend-active-check-fall', '2') %} {%- do slave_instance.__setitem__('health-check-fall', '2') %}
{%- endif %} {%- endif %}
{%- if 'backend-active-check-timeout' not in slave_instance %} {%- if 'health-check-timeout' not in slave_instance %}
{%- do slave_instance.__setitem__('backend-active-check-timeout', '2') %} {%- do slave_instance.__setitem__('health-check-timeout', '2') %}
{%- endif %} {%- endif %}
{%- do slave_instance.__setitem__('backend-active-check-http-path', slave_instance.get('backend-active-check-http-path') or '/') %} {%- do slave_instance.__setitem__('health-check-http-path', slave_instance.get('health-check-http-path') or '/') %}
{%- else %} {%- else %}
{%- do slave_instance.__setitem__('backend-active-check-http-method', '') %} {%- do slave_instance.__setitem__('health-check-http-method', '') %}
{%- do slave_instance.__setitem__('backend-active-check-http-version', '') %} {%- do slave_instance.__setitem__('health-check-http-version', '') %}
{%- do slave_instance.__setitem__('backend-active-check-http-path', '') %} {%- do slave_instance.__setitem__('health-check-http-path', '') %}
{%- endif %} {# if backend_active_check #} {%- endif %} {# if slave_instance['health-check'] #}
{#- Set Up log files #} {#- Set Up log files #}
{%- do slave_parameter_dict.__setitem__('access_log', '/'.join([caddy_log_directory, '%s_access_log' % slave_reference])) %} {%- do slave_parameter_dict.__setitem__('access_log', '/'.join([caddy_log_directory, '%s_access_log' % slave_reference])) %}
{%- do slave_parameter_dict.__setitem__('error_log', '/'.join([caddy_log_directory, '%s_error_log' % slave_reference])) %} {%- do slave_parameter_dict.__setitem__('error_log', '/'.join([caddy_log_directory, '%s_error_log' % slave_reference])) %}
......
...@@ -104,15 +104,15 @@ backend {{ slave_instance['slave_reference'] }}-{{ scheme }} ...@@ -104,15 +104,15 @@ backend {{ slave_instance['slave_reference'] }}-{{ scheme }}
retries {{ slave_instance['backend-connect-retries'] }} retries {{ slave_instance['backend-connect-retries'] }}
{%- set active_check_list = [] %} {%- set active_check_list = [] %}
{%- set active_check_option_list = [] %} {%- set active_check_option_list = [] %}
{%- if slave_instance['backend-active-check'] %} {%- if slave_instance['health-check'] %}
{%- do active_check_list.append('check') %} {%- do active_check_list.append('check') %}
{%- do active_check_list.append('inter %ss' % (slave_instance['backend-active-check-interval'])) %} {%- do active_check_list.append('inter %ss' % (slave_instance['health-check-interval'])) %}
{%- do active_check_list.append('rise %s' % (slave_instance['backend-active-check-rise'])) %} {%- do active_check_list.append('rise %s' % (slave_instance['health-check-rise'])) %}
{%- do active_check_list.append('fall %s' % (slave_instance['backend-active-check-fall'])) %} {%- do active_check_list.append('fall %s' % (slave_instance['health-check-fall'])) %}
{%- if slave_instance['backend-active-check-http-method'] != 'CONNECT' %} {%- if slave_instance['health-check-http-method'] != 'CONNECT' %}
{%- do active_check_option_list.append('option httpchk %s %s %s' % (slave_instance['backend-active-check-http-method'], slave_instance['backend-active-check-http-path'] | urlencode, slave_instance['backend-active-check-http-version'])) %} {%- do active_check_option_list.append('option httpchk %s %s %s' % (slave_instance['health-check-http-method'], slave_instance['health-check-http-path'] | urlencode, slave_instance['health-check-http-version'])) %}
{%- endif %} {%- endif %}
{%- do active_check_option_list.append('timeout check %ss' % (slave_instance['backend-active-check-timeout'])) %} {%- do active_check_option_list.append('timeout check %ss' % (slave_instance['health-check-timeout'])) %}
{%- endif %} {%- endif %}
server {{ slave_instance['slave_reference'] }}-backend {{ hostname }}:{{ port }} {{ ' '.join(ssl_list) }} {{ ' ' + ' '.join(active_check_list)}} server {{ slave_instance['slave_reference'] }}-backend {{ hostname }}:{{ port }} {{ ' '.join(ssl_list) }} {{ ' ' + ' '.join(active_check_list)}}
{%- for active_check_option in active_check_option_list %} {%- for active_check_option in active_check_option_list %}
......
...@@ -1854,7 +1854,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1854,7 +1854,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem(result.peercert)) der2pem(result.peercert))
self.assertNotIn('Strict-Transport-Security', result.headers) self.assertNotIn('Strict-Transport-Security', result.headers)
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '?a=b&c=/test-path/deeper')
try: try:
j = result.json() j = result.json()
...@@ -2085,7 +2085,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -2085,7 +2085,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'secure_access': 'https://%s.example.com' % (hostname, ), 'secure_access': 'https://%s.example.com' % (hostname, ),
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address,
'warning-list': [ 'warning-list': [
"slave url ' %s ' has been converted to '%s'" % ( "slave url ' %s/?a=b&c= ' has been converted to '%s/?a=b&c='" % (
self.backend_url, self.backend_url)], self.backend_url, self.backend_url)],
}, },
parameter_dict parameter_dict
...@@ -2137,7 +2137,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -2137,7 +2137,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'secure_access': 'https://%s.example.com' % (hostname, ), 'secure_access': 'https://%s.example.com' % (hostname, ),
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address,
'warning-list': [ 'warning-list': [
"slave url ' %s ' has been converted to '%s'" % ( "slave url ' %s/?a=b&c= ' has been converted to '%s/?a=b&c='" % (
self.backend_url, self.backend_url)], self.backend_url, self.backend_url)],
}, },
parameter_dict parameter_dict
...@@ -6204,45 +6204,45 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase): ...@@ -6204,45 +6204,45 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
'ssl_key': '${section:option}ssl_keyunsafe\nunsafe', 'ssl_key': '${section:option}ssl_keyunsafe\nunsafe',
'ssl_crt': '${section:option}ssl_crtunsafe\nunsafe', 'ssl_crt': '${section:option}ssl_crtunsafe\nunsafe',
}, },
'backend-active-check-http-method': { 'health-check-http-method': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-http-method': 'WRONG', 'health-check-http-method': 'WRONG',
}, },
'backend-active-check-http-version': { 'health-check-http-version': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-http-version': 'WRONG/1.1', 'health-check-http-version': 'WRONG/1.1',
}, },
'backend-active-check-timeout': { 'health-check-timeout': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-timeout': 'WRONG', 'health-check-timeout': 'WRONG',
}, },
'backend-active-check-timeout-negative': { 'health-check-timeout-negative': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-timeout': '-2', 'health-check-timeout': '-2',
}, },
'backend-active-check-interval': { 'health-check-interval': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-interval': 'WRONG', 'health-check-interval': 'WRONG',
}, },
'backend-active-check-interval-negative': { 'health-check-interval-negative': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-interval': '-2', 'health-check-interval': '-2',
}, },
'backend-active-check-rise': { 'health-check-rise': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-rise': 'WRONG', 'health-check-rise': 'WRONG',
}, },
'backend-active-check-rise-negative': { 'health-check-rise-negative': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-rise': '-2', 'health-check-rise': '-2',
}, },
'backend-active-check-fall': { 'health-check-fall': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-fall': 'WRONG', 'health-check-fall': 'WRONG',
}, },
'backend-active-check-fall-negative': { 'health-check-fall-negative': {
'backend-active-check': True, 'health-check': True,
'backend-active-check-fall': '-2', 'health-check-fall': '-2',
} }
} }
...@@ -6298,26 +6298,26 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase): ...@@ -6298,26 +6298,26 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
'_EMPTY-BACKEND': [ '_EMPTY-BACKEND': [
"slave https-url '' invalid", "slave https-url '' invalid",
"slave url '' invalid"], "slave url '' invalid"],
'_backend-active-check-fall': [ '_health-check-fall': [
'Wrong backend-active-check-fall WRONG'], 'Wrong health-check-fall WRONG'],
'_backend-active-check-fall-negative': [ '_health-check-fall-negative': [
'Wrong backend-active-check-fall -2'], 'Wrong health-check-fall -2'],
'_backend-active-check-http-method': [ '_health-check-http-method': [
'Wrong backend-active-check-http-method WRONG'], 'Wrong health-check-http-method WRONG'],
'_backend-active-check-http-version': [ '_health-check-http-version': [
'Wrong backend-active-check-http-version WRONG/1.1'], 'Wrong health-check-http-version WRONG/1.1'],
'_backend-active-check-interval': [ '_health-check-interval': [
'Wrong backend-active-check-interval WRONG'], 'Wrong health-check-interval WRONG'],
'_backend-active-check-interval-negative': [ '_health-check-interval-negative': [
'Wrong backend-active-check-interval -2'], 'Wrong health-check-interval -2'],
'_backend-active-check-rise': [ '_health-check-rise': [
'Wrong backend-active-check-rise WRONG'], 'Wrong health-check-rise WRONG'],
'_backend-active-check-rise-negative': [ '_health-check-rise-negative': [
'Wrong backend-active-check-rise -2'], 'Wrong health-check-rise -2'],
'_backend-active-check-timeout': [ '_health-check-timeout': [
'Wrong backend-active-check-timeout WRONG'], 'Wrong health-check-timeout WRONG'],
'_backend-active-check-timeout-negative': [ '_health-check-timeout-negative': [
'Wrong backend-active-check-timeout -2'], 'Wrong health-check-timeout -2'],
}, },
'warning-slave-dict': { 'warning-slave-dict': {
'_SSL_CA_CRT_ONLY': [ '_SSL_CA_CRT_ONLY': [
...@@ -7019,7 +7019,7 @@ class TestPassedRequestParameter(HttpFrontendTestCase): ...@@ -7019,7 +7019,7 @@ class TestPassedRequestParameter(HttpFrontendTestCase):
) )
class TestSlaveBackendActiveCheck(SlaveHttpFrontendTestCase, TestDataMixin): class TestSlaveHealthCheck(SlaveHttpFrontendTestCase, TestDataMixin):
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
return { return {
...@@ -7036,28 +7036,28 @@ class TestSlaveBackendActiveCheck(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -7036,28 +7036,28 @@ class TestSlaveBackendActiveCheck(SlaveHttpFrontendTestCase, TestDataMixin):
def getSlaveParameterDictDict(cls): def getSlaveParameterDictDict(cls):
cls.setUpAssertionDict() cls.setUpAssertionDict()
return { return {
'backend-active-check-disabled': { 'health-check-disabled': {
'url': cls.backend_url, 'url': cls.backend_url,
}, },
'backend-active-check-default': { 'health-check-default': {
'url': cls.backend_url, 'url': cls.backend_url,
'backend-active-check': True, 'health-check': True,
}, },
'backend-active-check-connect': { 'health-check-connect': {
'url': cls.backend_url, 'url': cls.backend_url,
'backend-active-check': True, 'health-check': True,
'backend-active-check-http-method': 'CONNECT', 'health-check-http-method': 'CONNECT',
}, },
'backend-active-check-custom': { 'health-check-custom': {
'url': cls.backend_url, 'url': cls.backend_url,
'backend-active-check': True, 'health-check': True,
'backend-active-check-http-method': 'POST', 'health-check-http-method': 'POST',
'backend-active-check-http-path': '/POST-path to be encoded', 'health-check-http-path': '/POST-path to be encoded',
'backend-active-check-http-version': 'HTTP/1.0', 'health-check-http-version': 'HTTP/1.0',
'backend-active-check-timeout': '7', 'health-check-timeout': '7',
'backend-active-check-interval': '15', 'health-check-interval': '15',
'backend-active-check-rise': '3', 'health-check-rise': '3',
'backend-active-check-fall': '7', 'health-check-fall': '7',
}, },
} }
...@@ -7065,35 +7065,35 @@ class TestSlaveBackendActiveCheck(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -7065,35 +7065,35 @@ class TestSlaveBackendActiveCheck(SlaveHttpFrontendTestCase, TestDataMixin):
def setUpAssertionDict(cls): def setUpAssertionDict(cls):
backend = urlparse.urlparse(cls.backend_url).netloc backend = urlparse.urlparse(cls.backend_url).netloc
cls.assertion_dict = { cls.assertion_dict = {
'backend-active-check-disabled': """\ 'health-check-disabled': """\
backend _backend-active-check-disabled-http backend _health-check-disabled-http
timeout server 12s timeout server 12s
timeout connect 5s timeout connect 5s
retries 3 retries 3
server _backend-active-check-disabled-backend %s""" % (backend,), server _health-check-disabled-backend %s""" % (backend,),
'backend-active-check-connect': """\ 'health-check-connect': """\
backend _backend-active-check-connect-http backend _health-check-connect-http
timeout server 12s timeout server 12s
timeout connect 5s timeout connect 5s
retries 3 retries 3
server _backend-active-check-connect-backend %s check inter 5s""" server _health-check-connect-backend %s check inter 5s"""
""" rise 1 fall 2 """ rise 1 fall 2
timeout check 2s""" % (backend,), timeout check 2s""" % (backend,),
'backend-active-check-custom': """\ 'health-check-custom': """\
backend _backend-active-check-custom-http backend _health-check-custom-http
timeout server 12s timeout server 12s
timeout connect 5s timeout connect 5s
retries 3 retries 3
server _backend-active-check-custom-backend %s check inter 15s""" server _health-check-custom-backend %s check inter 15s"""
""" rise 3 fall 7 """ rise 3 fall 7
option httpchk POST /POST-path%%20to%%20be%%20encoded HTTP/1.0 option httpchk POST /POST-path%%20to%%20be%%20encoded HTTP/1.0
timeout check 7s""" % (backend,), timeout check 7s""" % (backend,),
'backend-active-check-default': """\ 'health-check-default': """\
backend _backend-active-check-default-http backend _health-check-default-http
timeout server 12s timeout server 12s
timeout connect 5s timeout connect 5s
retries 3 retries 3
server _backend-active-check-default-backend %s check inter 5s""" server _health-check-default-backend %s check inter 5s"""
""" rise 1 fall 2 """ rise 1 fall 2
option httpchk GET / HTTP/1.1 option httpchk GET / HTTP/1.1
timeout check 2s""" % (backend, ) timeout check 2s""" % (backend, )
...@@ -7125,17 +7125,17 @@ backend _backend-active-check-default-http ...@@ -7125,17 +7125,17 @@ backend _backend-active-check-default-http
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
def test_backend_active_check_disabled(self): def test_health_check_disabled(self):
self._test('backend-active-check-disabled') self._test('health-check-disabled')
def test_backend_active_check_default(self): def test_health_check_default(self):
self._test('backend-active-check-default') self._test('health-check-default')
def test_backend_active_check_connect(self): def test_health_check_connect(self):
self._test('backend-active-check-connect') self._test('health-check-connect')
def test_backend_active_check_custom(self): def test_health_check_custom(self):
self._test('backend-active-check-custom') self._test('health-check-custom')
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -9,18 +9,18 @@ T-2/var/log/backend-haproxy.log ...@@ -9,18 +9,18 @@ T-2/var/log/backend-haproxy.log
T-2/var/log/expose-csr_id.log T-2/var/log/expose-csr_id.log
T-2/var/log/frontend-access.log T-2/var/log/frontend-access.log
T-2/var/log/frontend-error.log T-2/var/log/frontend-error.log
T-2/var/log/httpd/_backend-active-check-connect_access_log T-2/var/log/httpd/_health-check-connect_access_log
T-2/var/log/httpd/_backend-active-check-connect_backend_log T-2/var/log/httpd/_health-check-connect_backend_log
T-2/var/log/httpd/_backend-active-check-connect_error_log T-2/var/log/httpd/_health-check-connect_error_log
T-2/var/log/httpd/_backend-active-check-custom_access_log T-2/var/log/httpd/_health-check-custom_access_log
T-2/var/log/httpd/_backend-active-check-custom_backend_log T-2/var/log/httpd/_health-check-custom_backend_log
T-2/var/log/httpd/_backend-active-check-custom_error_log T-2/var/log/httpd/_health-check-custom_error_log
T-2/var/log/httpd/_backend-active-check-default_access_log T-2/var/log/httpd/_health-check-default_access_log
T-2/var/log/httpd/_backend-active-check-default_backend_log T-2/var/log/httpd/_health-check-default_backend_log
T-2/var/log/httpd/_backend-active-check-default_error_log T-2/var/log/httpd/_health-check-default_error_log
T-2/var/log/httpd/_backend-active-check-disabled_access_log T-2/var/log/httpd/_health-check-disabled_access_log
T-2/var/log/httpd/_backend-active-check-disabled_backend_log T-2/var/log/httpd/_health-check-disabled_backend_log
T-2/var/log/httpd/_backend-active-check-disabled_error_log T-2/var/log/httpd/_health-check-disabled_error_log
T-2/var/log/monitor-httpd-access.log T-2/var/log/monitor-httpd-access.log
T-2/var/log/monitor-httpd-error.log T-2/var/log/monitor-httpd-error.log
T-2/var/log/slave-introspection-access.log T-2/var/log/slave-introspection-access.log
......
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