Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
slapos
Commits
264bd051
Commit
264bd051
authored
May 26, 2021
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/re6stnet: Fix slave instance parameters passing and add test
parent
077bb4c1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
11 deletions
+40
-11
software/re6stnet/buildout.hash.cfg
software/re6stnet/buildout.hash.cfg
+2
-2
software/re6stnet/instance-re6stnet.cfg.in
software/re6stnet/instance-re6stnet.cfg.in
+4
-9
software/re6stnet/instance.cfg.in
software/re6stnet/instance.cfg.in
+1
-0
software/re6stnet/test/test.py
software/re6stnet/test/test.py
+33
-0
No files found.
software/re6stnet/buildout.hash.cfg
View file @
264bd051
...
...
@@ -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
...
...
software/re6stnet/instance-re6stnet.cfg.in
View file @
264bd051
{% 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 =
...
...
software/re6stnet/instance.cfg.in
View file @
264bd051
...
...
@@ -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
...
...
software/re6stnet/test/test.py
View file @
264bd051
...
...
@@ -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'
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment