Commit 25773f20 authored by Jérome Perrin's avatar Jérome Perrin

erp5: start runUnitTest's zserver on the partition IP

We don't want runUnitTest is to listen on 127.0.0.1, as it is not
allowed for SlapOS instances. Another reason for the change is because
we are using userhosts, name resolution of localhost was done on DNS
server and not all DNS server resolves localhost.

Because zelenium tests needs to access this zserver over a secure
origin, add an https proxy in the balancer for tests.

Document the existing behavior that setting mariadb.test-database-amount
to 0 disable the creation of testrunner, now that it also controls the
generation of one balancer entry.
parent 4307a5b8
......@@ -38,7 +38,7 @@
"type": "array"
},
"test-database-amount": {
"description": "The number of test databases to create, adding auto-generated entries to database-list",
"description": "The number of test databases to create, adding auto-generated entries to database-list. Setting this to 0 disable the creation of test runner.",
"default": 1,
"minimum": 0,
"type": "integer"
......
......@@ -74,7 +74,7 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = 9f8851af5faed9d1e346d7dbe0e6db5d
md5sum = da7d588c6e7435e41721094865df439d
[template-zeo]
filename = instance-zeo.cfg.in
......@@ -82,11 +82,11 @@ md5sum = 3e650915959ff31c9c13c84069bbcd35
[template-zope]
filename = instance-zope.cfg.in
md5sum = a4dda17c1671ead45ac92b7decc32228
md5sum = 8f1c2cf262357022d3db34f408130fd3
[template-balancer]
filename = instance-balancer.cfg.in
md5sum = 89872075cd2f31d824369447aaf0532f
md5sum = 2cef6f78f60ca7bd8ede1d1e394a17f8
[template-haproxy-cfg]
filename = haproxy.cfg.in
......
......@@ -142,6 +142,19 @@ ipv6 = {{ zope_address.split(']:')[0][1:] }}
{% endif -%}
{% set ssl_authentication = slapparameter_dict['ssl-authentication-dict'].get(family_name, False) -%}
{% do apache_dict.__setitem__(family_name, (next_port(), external_scheme, internal_scheme ~ '://' ~ ipv4 ~ ':' ~ haproxy_port ~ backend_path, ssl_authentication)) -%}
{# XXX do we need to loop on parameter_id_list ? #}
{% set run_unit_test_url = slapparameter_dict.get(parameter_id_list[0] + '-run-unit-test-url') %}
{% if run_unit_test_url %}
{% set run_unit_test_external_port = next_port() %}
{# XXX Only work ipv4 as ipv4 is usually local and because ipv6 is not support here at the moment https://bugs.launchpad.net/zope2/+bug/699865 #}
{% do apache_dict.__setitem__(family_name ~ '-run-unit-test', (
run_unit_test_external_port,
external_scheme,
run_unit_test_url ~ '/VirtualHostBase/' ~ external_scheme ~ '/' ~ ipv4 ~ ':' ~ run_unit_test_external_port ~ '/VirtualHostRoot/',
ssl_authentication)) -%}
{% endif %}
{% endfor -%}
[haproxy-cfg-parameter-dict]
......
......@@ -8,6 +8,7 @@
{% set jupyter_dict = slapparameter_dict.get('jupyter', {}) -%}
{% set has_jupyter = jupyter_dict.get('enable', jupyter_enable_default.lower() in ('true', 'yes')) -%}
{% set jupyter_zope_family = jupyter_dict.get('zope-family', '') -%}
{% set generate_test_runner = (slapparameter_dict.get('mariadb', {}).get('test-database-amount', 1) > 0) -%}
{% set monitor_base_url_dict = {} -%}
{% set caucase_url = slapparameter_dict.get('caucase', {}).pop('url', '') -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
......@@ -142,6 +143,9 @@ return =
zope-address-list
hosts-dict
monitor-base-url
{%- if generate_test_runner %}
run-unit-test-url
{% endif %}
{% set bt5_default_list = 'erp5_full_text_myisam_catalog erp5_configurator_standard erp5_configurator_maxma_demo erp5_configurator_run_my_doc' -%}
{% if has_jupyter -%}
{% set bt5_default_list = bt5_default_list + ' erp5_data_notebook' -%}
......@@ -267,13 +271,19 @@ return =
{%- for family in zope_family_dict %}
{{ family }}
{{ family }}-v6
{% endfor -%}
{% if generate_test_runner %}
{{ family }}-run-unit-test
{% endif %}
{% endfor %}
{% do monitor_base_url_dict.__setitem__('request-balancer', '${' ~ 'request-balancer' ~ ':connection-monitor-base-url}') -%}
config-zope-family-dict = {{ dumps(zope_family_parameter_dict) }}
config-tcpv4-port = {{ dumps(balancer_dict.get('tcpv4-port', 2150)) }}
{% for zope_section_id, name in zope_address_list_id_dict.items() -%}
config-{{ name }} = {{ ' ${' ~ zope_section_id ~ ':connection-zope-address-list}' }}
{% if generate_test_runner -%}
config-{{ name }}-run-unit-test-url = {{ ' ${' ~ zope_section_id ~ ':connection-run-unit-test-url}' }}
{% endif -%}
{% endfor -%}
# XXX: should those really be same for all families ?
config-haproxy-server-check-path = {{ dumps(balancer_dict.get('haproxy-server-check-path', '/') % {'site-id': site_id}) }}
......
......@@ -8,6 +8,7 @@
{% set part_list = [] -%}
{% set publish_list = [] -%}
{% set longrequest_logger_base_path = buildout_directory ~ '/var/log/longrequest_logger_' -%}
{% set generate_test_runner = slapparameter_dict['mysql-test-url-list'] -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{#
......@@ -67,7 +68,9 @@ ca-certs = ${directory:test-ca-certs}
ca-newcerts = ${directory:test-ca-newcerts}
ca-crl = ${directory:test-ca-crl}
{% if slapparameter_dict['mysql-test-url-list'] -%}
{% if generate_test_runner -%}
{% set runUnitTest_zserver_port = next_port() %}
[{{ section('run-unit-test-userhosts-wrapper') }}]
<= userhosts-wrapper-base
wrapped-command-line = ${runUnitTest:wrapper-path}
......@@ -118,6 +121,7 @@ command-name = runUnitTest
command-line-extra =
--erp5_sql_connection_string '{{ connection_string_list[0] }}'
--extra_sql_connection_string_list '{{ ','.join(connection_string_list[1:]) }}'
--zserver {{ ipv4 ~ ':' ~ runUnitTest_zserver_port }}
[{{ section('runTestSuite') }}]
< = run-test-common
......@@ -452,6 +456,9 @@ hard to guess.
-#}
hosts-dict = {{ dumps(hosts_dict) }}
monitor-base-url = ${monitor-publish-parameters:monitor-base-url}
{% if generate_test_runner -%}
run-unit-test-url = {{ dumps('http://' ~ ipv4 ~ ':' ~ runUnitTest_zserver_port) }}
{% endif %}
[monitor-instance-parameter]
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
......
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