Commit ea678876 authored by Łukasz Nowak's avatar Łukasz Nowak

Setup and pass return information server

Now the testing partition is able to fetch data from tested VM, by using
its public ipv6 address, to which the VM can post results.
parent 16b1c465
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
# it in text form with data-to-vm # it in text form with data-to-vm
# #
# Format of data-to-vm is shell script: # Format of data-to-vm is shell script:
# URL=<url>\nWAITTIME=<seconds>\nTRIES=<amount> # SCRIPTURL=<url>\nPOSTURL=<url>\nWAITTIME=<seconds>\nTRIES=<amount>
# #
# Expected values in configuration: # Expected values in configuration:
# * URL - the url of the script to download and test # * SCRIPTURL - the url of the script to download and test
# * POSTURL - the url to which results will be posted
# * WAITTIME - waiting time, before next try # * WAITTIME - waiting time, before next try
# * TRIES - amount of tries # * TRIES - amount of tries
...@@ -33,8 +34,13 @@ if [ -z "$LOG_FILE" ] ; then ...@@ -33,8 +34,13 @@ if [ -z "$LOG_FILE" ] ; then
exit 1 exit 1
fi fi
if [ -z "$URL" ] ; then if [ -z "$SCRIPTURL" ] ; then
echo "URL is missing" >> $LOG_FILE 2>&1 echo "SCRIPTURL is missing" >> $LOG_FILE 2>&1
exit 1
fi
if [ -z "$POSTURL" ] ; then
echo "POSTURL is missing" >> $LOG_FILE 2>&1
exit 1 exit 1
fi fi
...@@ -49,7 +55,7 @@ if [ -z "$TRIES" ] ; then ...@@ -49,7 +55,7 @@ if [ -z "$TRIES" ] ; then
fi fi
DEPLOYMENT_SCRIPT=/tmp/test-script-deployment.bash.$$ DEPLOYMENT_SCRIPT=/tmp/test-script-deployment.bash.$$
wget -O $DEPLOYMENT_SCRIPT -q $URL wget -O $DEPLOYMENT_SCRIPT -q $SCRIPTURL
try=1 try=1
while true; do while true; do
...@@ -73,5 +79,5 @@ done ...@@ -73,5 +79,5 @@ done
echo "$0: Try $try. Uploading log and exiting with $result." >> $LOG_FILE 2>&1 echo "$0: Try $try. Uploading log and exiting with $result." >> $LOG_FILE 2>&1
t=`date '+%Y%m%d%H%S'` t=`date '+%Y%m%d%H%S'`
mv $LOG_FILE ${LOG_FILE}.$t 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/ curl -q -X POST --data-urlencode "path=test-script-result/log-file.log.$t" --data-urlencode "content@${LOG_FILE}.$t" $POSTURL
exit $result exit $result
...@@ -7,6 +7,8 @@ offline = true ...@@ -7,6 +7,8 @@ offline = true
parts = parts =
request-kvm request-kvm
deploy-unit-test deploy-unit-test
httpd
httpd-promise
[request-kvm] [request-kvm]
<= slap-connection <= slap-connection
...@@ -25,9 +27,31 @@ config-virtual-hard-drive-md5sum = {{ slapparameter_dict.get('image-to-test-md5s ...@@ -25,9 +27,31 @@ config-virtual-hard-drive-md5sum = {{ slapparameter_dict.get('image-to-test-md5s
# The test script # The test script
config-bootstrap-script-url = {{ in_vm_test_script }}#{{ in_vm_test_script_md5 }} config-bootstrap-script-url = {{ in_vm_test_script }}#{{ in_vm_test_script_md5 }}
# Script configuration
config-data-to-vm =
SCRIPTURL=TODO
POSTURL=http://[${httpd:host}]:${httpd:port}/
WAITTIME=3600
TRIES=10
# require HTTP server # require HTTP server
config-enable-http-server = true config-enable-http-server = true
[httpd]
recipe = slapos.cookbook:simplehttpserver
host = ${slap-network-information:global-ipv6}
port = 8080
base-path = ${directory:public}
wrapper = ${directory:services}/http-server
log-file = ${directory:log}/httpd.log
use-hash-url = false
[httpd-promise]
recipe = slapos.cookbook:check_port_listening
path = ${directory:promises}/httpd
hostname = ${httpd:host}
port = ${httpd:port}
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory} home = ${buildout:directory}
...@@ -39,6 +63,8 @@ tmp = ${:home}/tmp/ ...@@ -39,6 +63,8 @@ tmp = ${:home}/tmp/
log = ${:var}/log/ log = ${:var}/log/
services = ${:etc}/service/ services = ${:etc}/service/
scripts = ${:etc}/run/ scripts = ${:etc}/run/
public = ${:srv}/public/
promises = ${:etc}/promise
[deploy-unit-test] [deploy-unit-test]
recipe = collective.recipe.template recipe = collective.recipe.template
......
...@@ -12,7 +12,7 @@ recipe = slapos.recipe.download ...@@ -12,7 +12,7 @@ recipe = slapos.recipe.download
ignore-existing = true ignore-existing = true
filename = in-vm-test filename = in-vm-test
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
md5sum = 9039e7515483a9d64396b28fc43c678c md5sum = 20a1086d749d831692ec8e3e7e5c9184
mode = 0644 mode = 0644
download-only = true download-only = true
on-update = true on-update = true
...@@ -28,7 +28,7 @@ mode = 0644 ...@@ -28,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 = cd030eaf5e66607b31497fdd07d6ed17 md5sum = 6a8203a978f2fda95e967b6407797e55
mode = 0644 mode = 0644
download-only = true download-only = true
on-update = true on-update = true
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