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
Łukasz Nowak
slapos
Commits
16b1c465
Commit
16b1c465
authored
Mar 27, 2017
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass through test script
parent
7581d70b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
2 deletions
+112
-2
software/cdn-test/in-vm-test
software/cdn-test/in-vm-test
+77
-0
software/cdn-test/instance-cdn-test.cfg.jinja2
software/cdn-test/instance-cdn-test.cfg.jinja2
+21
-0
software/cdn-test/instance.cfg.in
software/cdn-test/instance.cfg.in
+2
-0
software/cdn-test/software.cfg
software/cdn-test/software.cfg
+12
-2
No files found.
software/cdn-test/in-vm-test
0 → 100644
View file @
16b1c465
#!/bin/bash
# Script for testing deployment script
#
# Assumption: deployment script returning with code 0
# run correctly and everything is done
#
# This script is run inside of KVM, by passing its
# URL with bootstrap-script-url
# The script configuration happens by passing
# it in text form with data-to-vm
#
# Format of data-to-vm is shell script:
# URL=<url>\nWAITTIME=<seconds>\nTRIES=<amount>
#
# Expected values in configuration:
# * URL - the url of the script to download and test
# * WAITTIME - waiting time, before next try
# * TRIES - amount of tries
# Possible TODOs:
# * post results on each try
# * use function + trap to assure posting on exit
LOG_FILE
=
/var/log/test-script-deployment.log
wget
-O
/tmp/test-script.cfg.
$$
-q
http://10.0.2.100/data
source
/tmp/test-script.cfg.
$$
if
[
-z
"
$LOG_FILE
"
]
;
then
echo
"Output log file is missing"
exit
1
fi
if
[
-z
"
$URL
"
]
;
then
echo
"URL is missing"
>>
$LOG_FILE
2>&1
exit
1
fi
if
[
-z
"
$WAITTIME
"
]
;
then
echo
"WAITTIME missing"
>>
$LOG_FILE
2>&1
exit
1
fi
if
[
-z
"
$TRIES
"
]
;
then
echo
"TRIES missing"
>>
$LOG_FILE
2>&1
exit
1
fi
DEPLOYMENT_SCRIPT
=
/tmp/test-script-deployment.bash.
$$
wget
-O
$DEPLOYMENT_SCRIPT
-q
$URL
try
=
1
while
true
;
do
echo
"
$0
: Try
$try
. Running '/bin/bash
$DEPLOYMENT_SCRIPT
'"
>>
$LOG_FILE
2>&1
/bin/bash
$DEPLOYMENT_SCRIPT
>>
$LOG_FILE
2>&1
result
=
$?
if
[
$result
==
0
]
;
then
echo
"
$0
: Try
$try
. Script executed successfully."
>>
$LOG_FILE
2>&1
break
fi
if
((
try
>
TRIES
))
;
then
echo
"
$0
: Try
$try
. Amount of tries
$TRIES
exceeded, giving up."
>>
$LOG_FILE
2>&1
break
fi
# wait WAITTIME before checking the state
echo
"
$0
: Try
$try
. Sleeping
$WAITTIME
before retry."
>>
$LOG_FILE
2>&1
sleep
$WAITTIME
((
try++
))
done
echo
"
$0
: Try
$try
. Uploading log and exiting with
$result
."
>>
$LOG_FILE
2>&1
t
=
`
date
'+%Y%m%d%H%S'
`
mv
$LOG_FILE
${
LOG_FILE
}
.
$t
curl
-q
-X
POST
--data-urlencode
"path=test-script-result/log-file.log.
$t
"
--data-urlencode
"content@
${
LOG_FILE
}
.
$t
"
http://10.0.2.100/
exit
$result
software/cdn-test/instance-cdn-test.cfg.jinja2
View file @
16b1c465
...
@@ -5,8 +5,29 @@ develop-eggs-directory = {{ develop_eggs_directory }}
...
@@ -5,8 +5,29 @@ develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
offline = true
parts =
parts =
request-kvm
deploy-unit-test
deploy-unit-test
[request-kvm]
<= slap-connection
recipe = slapos.cookbook:request
software-url = ${slap-connection:software-release-url}
software-type = kvm
name = test-kvm
sla-computer_guid = ${slap-connection:computer-id}
# Tested image
# Passed by request
config-virtual-hard-drive-url = {{ slapparameter_dict.get('image-to-test-url') }}
config-virtual-hard-drive-md5sum = {{ slapparameter_dict.get('image-to-test-md5sum') }}
# The test script
config-bootstrap-script-url = {{ in_vm_test_script }}#{{ in_vm_test_script_md5 }}
# require HTTP server
config-enable-http-server = true
[directory]
[directory]
recipe = slapos.cookbook:mkdirectory
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
home = ${buildout:directory}
...
...
software/cdn-test/instance.cfg.in
View file @
16b1c465
...
@@ -14,4 +14,6 @@ context =
...
@@ -14,4 +14,6 @@ context =
key eggs_directory buildout:eggs-directory
key eggs_directory buildout:eggs-directory
key slapparameter_dict slap-configuration:configuration
key slapparameter_dict slap-configuration:configuration
raw bin_directory ${buildout:bin-directory}
raw bin_directory ${buildout:bin-directory}
raw in_vm_test_script ${in-vm-test-script:location}/${in-vm-test-script:filename}
raw in_vm_test_script_md5 ${in-vm-test-script:md5sum}
mode = 0644
mode = 0644
software/cdn-test/software.cfg
View file @
16b1c465
...
@@ -7,10 +7,20 @@ parts =
...
@@ -7,10 +7,20 @@ parts =
[template]
[template]
output = ${buildout:directory}/template-original.kvm.cfg
output = ${buildout:directory}/template-original.kvm.cfg
[in-vm-test-script]
recipe = slapos.recipe.download
ignore-existing = true
filename = in-vm-test
url = ${:_profile_base_location_}/${:filename}
md5sum = 9039e7515483a9d64396b28fc43c678c
mode = 0644
download-only = true
on-update = true
[template-cdn-test]
[template-cdn-test]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
url = ${:_profile_base_location_}/instance.cfg.in
md5sum =
13f5bc9afd895d0c8b0b218a7c5ecb4b
md5sum =
908c84181eab046757f2a1ef56174285
output = ${buildout:directory}/template.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
mode = 0644
...
@@ -18,7 +28,7 @@ mode = 0644
...
@@ -18,7 +28,7 @@ mode = 0644
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
ignore-existing = true
ignore-existing = true
url = ${:_profile_base_location_}/instance-cdn-test.cfg.jinja2
url = ${:_profile_base_location_}/instance-cdn-test.cfg.jinja2
md5sum =
abf54e393a1fe58dd6dfca37c38f7464
md5sum =
cd030eaf5e66607b31497fdd07d6ed17
mode = 0644
mode = 0644
download-only = true
download-only = true
on-update = true
on-update = true
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