{% set script_url = slapparameter_dict.get('script-to-test-url') -%}
[buildout]

eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true

parts =
  request-kvm
  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 }}

# Script configuration
config-data-to-vm =
  URL={{ script_url }}
  WAITTIME={{ waittime }}
  TRIES={{ tries }}

# require HTTP server
config-enable-http-server = true

[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc/
var = ${:home}/var/
srv = ${:home}/srv/
bin = ${:home}/bin/
tmp = ${:home}/tmp/
log = ${:var}/log/
services = ${:etc}/service/
scripts = ${:etc}/run/

[deploy-unit-test]
recipe = collective.recipe.template
input = inline:
  #!/bin/sh
  exit 0
output = ${directory:bin}/runTestSuite
mode = 755

