Commit eeb548a6 authored by Joanne Hugé's avatar Joanne Hugé

software/re6stnet: Fix slave instance parameters passing and add test

See merge request nexedi/slapos!983
parents 3c211d70 264bd051
Pipeline #15847 failed with stage
in 0 seconds
......@@ -6,11 +6,9 @@ parts = faketime
[faketime]
recipe = slapos.recipe.cmmi
url = http://www.code-wizards.com/projects/libfaketime/libfaketime-0.9.1.tar.gz
md5sum = ce3f996dfd5826b4ac62f1a7cc36ea27
url = https://github.com/wolfcw/libfaketime/archive/refs/tags/v0.9.9.tar.gz
md5sum = 1f784c9c0ec7807b9d1107d1730dbb41
configure-command = true
make-options =
PREFIX=${buildout:parts-directory}/${:_buildout_section_name_}
make-binary = make -e -C src
make-targets = install
post-install = sed -i -e "16c\FTPL_PATH=${buildout:parts-directory}/${:_buildout_section_name_}/lib/faketime" ${buildout:parts-directory}/${:_buildout_section_name_}/bin/faketime
......@@ -14,11 +14,11 @@
# not need these here).
[template]
filename = instance.cfg.in
md5sum = 01938aa1683b7994f814fff6d964b9ba
md5sum = 71531ed9c9b79fa769ab367e7ea2d2a5
[template-re6stnet]
filename = instance-re6stnet.cfg.in
md5sum = 4e4475c8ef80a3a53aa63a2ae444586d
md5sum = 2309889cf3f5bc57ba63d389e662fc21
[template-apache-conf]
filename = apache.conf.in
......
{% set bin_directory = parameter_dict['bin-directory'] -%}
{% set python_bin = parameter_dict['python-executable'] -%}
{% set publish_dict = {} -%}
{% set ipv6 = (ipv6_set | list)[0] -%}
{% set ipv4 = (ipv4_set | list)[0] -%}
......@@ -136,8 +135,7 @@ db-path = ${re6st-registry-conf-dict:db}
key-file = ${re6st-registry-conf-dict:key}
cert-file = ${re6st-registry-conf-dict:ca}
dh-file = ${re6st-registry-conf-dict:dh}
slave-instance-list = {{ slapparameter_dict.get('slave_instance_list', '{}') }}
slave-instance-list = {{ dumps(slave_instance_list) }}
environment =
PATH={{ openssl_bin }}
......@@ -184,15 +182,12 @@ name = apache-re6st-registry.py
config-hostname = ${apache-conf:ipv6}
config-port = ${apache-conf:port}
{% do publish_dict.__setitem__('re6stry-url', 'http://[${apache-conf:ipv6}]:${apache-conf:port}') -%}
{% do publish_dict.__setitem__('re6stry-local-url', 'http://${re6st-registry:ipv4}:${re6st-registry:port}/') -%}
{% do publish_dict.__setitem__('slave-amount', '${re6st-registry:slave-amount}') -%}
[publish]
recipe = slapos.cookbook:publish
monitor-setup-url = https://monitor.app.officejs.com/#page=settings_configurator&url=${monitor-publish-parameters:monitor-url}&username=${monitor-publish-parameters:monitor-user}&password=${monitor-publish-parameters:monitor-password}
{% for name, value in publish_dict.items() -%}
{{ name }} = {{ value }}
{% endfor -%}
slave-amount = {{ len(slave_instance_list) }}
re6stry-url = http://[${apache-conf:ipv6}]:${apache-conf:port}
re6stry-local-url = http://${re6st-registry:ipv4}:${re6st-registry:port}
[buildout]
extends =
......
......@@ -40,6 +40,7 @@ extensions = jinja2.ext.do
extra-context =
section parameter_dict dynamic-template-re6stnet-parameters
raw monitor2_template_rendered {{ monitor2_template_rendered }}
key slave_instance_list slap-configuration:slave-instance-list
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
......
......@@ -26,10 +26,12 @@
##############################################################################
import os
import time
import requests
import json
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
from slapos.testing.utils import CrontabMixin
setUpModule, Re6stnetTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath(
......@@ -56,3 +58,34 @@ class TestPortRedirection(Re6stnetTestCase):
'srcPort': 9201,
'destPort': 9201,
}, portredir_config[0])
class TestTokens(Re6stnetTestCase, CrontabMixin):
partition_reference = "SOFTINST-1"
@classmethod
def requestDefaultInstance(cls, state='started'):
default_instance = super(
Re6stnetTestCase, cls).requestDefaultInstance(state=state)
cls.requestSlaveInstance()
return default_instance
@classmethod
def requestSlaveInstance(cls):
software_url = cls.getSoftwareURL()
cls.logger.debug('requesting slave "%s"', cls.partition_reference)
return cls.slap.request(
software_release=software_url,
partition_reference=cls.partition_reference,
partition_parameter_kw={},
shared=True,
)
def test_tokens(self):
self._executeCrontabAtDate('re6stnet-check-token', '+10min')
self.slap.waitForInstance() # Wait until publish is done
s = self.requestSlaveInstance()
self.assertEqual("Token is ready for use", s.getConnectionParameterDict()['1_info'])
......@@ -189,7 +189,7 @@ scandir = 1.10.0
setuptools-dso = 1.7
rubygemsrecipe = 0.3.0
six = 1.12.0
slapos.cookbook = 1.0.184
slapos.cookbook = 1.0.197
slapos.core = 1.6.13
slapos.extension.strip = 0.4
slapos.extension.shared = 1.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