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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
slapos
Commits
6d8af21f
Commit
6d8af21f
authored
Aug 07, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slave-test: add promise to self-test.
parent
f1f49642
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
software/test-slave-instance-deployment/instance-default.cfg
software/test-slave-instance-deployment/instance-default.cfg
+22
-0
software/test-slave-instance-deployment/parameter-check-promise.py.in
...t-slave-instance-deployment/parameter-check-promise.py.in
+29
-0
software/test-slave-instance-deployment/software.cfg
software/test-slave-instance-deployment/software.cfg
+16
-0
No files found.
software/test-slave-instance-deployment/instance-default.cfg
View file @
6d8af21f
...
...
@@ -2,10 +2,19 @@
parts =
publish-connection-informations
request-slave-instance
check-connection-informations-promise
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[directories]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
scripts = $${:etc}/run
services = $${:etc}/service
promises = $${:etc}/promise
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = $${slap-connection:computer-id}
...
...
@@ -43,3 +52,16 @@ test-instance-state = $${request-test-instance:instance-state}
test-instance-slave-instance-list = $${request-test-instance:connection-slave-instance-list}
root-instance-slave-instance-list = $${slap-configuration:slave-instance-list}
slave-instance-parameter = $${request-slave-instance:connection-foo}
# Create a file containing connection parameters
# Then create a promise that will check content of this file
[dump-connection-informations]
<= publish-connection-informations
recipe = slapos.cookbook:jsondump
json-output = $${buildout:directory}/connection-parameters.json
[check-connection-informations-promise]
recipe = collective.recipe.template
input = ${promise-template:output}
output = $${directories:promises}/checkparameters
mode = 700
software/test-slave-instance-deployment/parameter-check-promise.py.in
0 → 100644
View file @
6d8af21f
#!${buildout:executable}
import sys
import os
import json
json_file = '$${dump-connection-informations:json-output}'
connection_parameter_list = json.loads(open(json_file, 'r').read())
# XXX list all problems before exit
# XXX: factor in a clean dict loop
test_instance_guid = connection_parameter_list['test-instance-guid']
if not test_instance_guid == 'slappart1':
print 'Bad test-instance-guid connection parameter: %s' % test_instance_guid
sys.exit(1)
test_instance_state = connection_parameter_list['test-instance-state']
if not test_instance_state == 'started':
print 'Bad test-instance-state connection parameter: %s instead of started' % test_instance_state
sys.exit(1)
test_instance_slave_instance_list = connection_parameter_list['test-instance-slave-instance-list']
if test_instance_slave_instance_list == []:
print 'test-instance-slave-instance-list connection parameter is empty.'
sys.exit(1)
root_instance_slave_instance_list = connection_parameter_list['root-instance-slave-instance-list']
if root_instance_slave_instance_list != []:
print 'root-instance-slave-instance-list connection parameter is not empty.'
sys.exit(1)
slave_instance_parameter = connection_parameter_list['slave-instance-parameter']
if slave_instance_parameter != 'I am slave instance, and I am deployed!':
print 'parameter slave-instance-parameter is not correct.'
sys.exit(1)
software/test-slave-instance-deployment/software.cfg
View file @
6d8af21f
# This Software Release is used to test
# the behavior of Slave Instances in slapos and in slaprunner.
[buildout]
develop =
/srv/slapgrid/slappart74/srv//runner/project/slapos
parts =
slapos-cookbook
instance-profile
collective-egg
[instance-profile]
recipe = slapos.recipe.template
...
...
@@ -23,6 +28,16 @@ url = ${:_profile_base_location_}/instance-test.cfg
output = ${buildout:directory}/instance-test.cfg
mode = 0644
[promise-template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/parameter-check-promise.py.in
output = ${buildout:directory}/parameter-check-promise.py
mode = 0644
[collective-egg]
recipe = zc.recipe.egg
eggs = collective.recipe.template
[versions]
Jinja2 = 2.7.3
MarkupSafe = 0.23
...
...
@@ -51,6 +66,7 @@ slapos.recipe.template = 2.5
stevedore = 0.15
supervisor = 3.1.0
xml-marshaller = 0.9.7
collective.recipe.template = 1.11
# Required by:
# slapos.core==1.1.2
...
...
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