[buildout]
extends =
  ../software.cfg
  ../../../component/vm-img/debian.cfg
parts =
  slapos-cookbook
  template
  neoppod-develop
  neolog

[template]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/template.cfg
template =
  inline:[buildout]
  eggs-directory = ${buildout:eggs-directory}
  develop-eggs-directory = ${buildout:develop-eggs-directory}
  parts = runTestSuite
  [slap-configuration]
  recipe = slapos.cookbook:slapconfiguration.serialised
  computer = $${slap-connection:computer-id}
  partition = $${slap-connection:partition-id}
  url = $${slap-connection:server-url}
  key = $${slap-connection:key-file}
  cert = $${slap-connection:cert-file}
  [directory]
  recipe = slapos.cookbook:mkdirectory
  bin = $${buildout:directory}/bin
  [runTestSuite]
  recipe = slapos.recipe.template:jinja2
  rendered = $${directory:bin}/$${:_buildout_section_name_}
  template = ${:_profile_base_location_}/$${:_buildout_section_name_}.in
  mode = 0755
  context =
    section buildout buildout
    section parameter_dict runTestSuite-parameters
    key slapparameter_dict slap-configuration:configuration
  [runTestSuite-parameters]
  environment = {{dumps(environment)}}
  vm = {{dumps(vm)}}
  runTestSuite_py = ${buildout:bin-directory}/${runTestSuite_py:interpreter}
  profile_base_location = ${:_profile_base_location_}
  neoppod = ${neoppod-repository:location}
context =
  section environment vm-run-environment
  section vm vm-debian

[runTestSuite_py]
eggs +=
  zc.buildout
  slapos.libnetworkcache
[slapos-cookbook]
scripts =

# Just in case one wants to inspect logs on the testnode itself.
[neolog]
recipe = zc.recipe.egg
eggs =
  ${msgpack-python:egg}
  neoppod
scripts = neolog

[neoppod-repository]
# When run from erp5.util:testnode (and this always the case), shared=true is
# added to this section and the path in .git/objects/info/alternates is outside
# the 'neoppod' mount point of the VM. Let's mount the testnode working copy
# directly. Comment the following 2 lines if 'repository' is a URL.
recipe =
location = ${:repository}

[vm-debian]
# Mainly for logs, otherwise 2G would enough (<100M for the SR).
size = 8Gi
late-command +=
  echo tmpfs /tmp tmpfs mode=1777,size=90% 0 0 >>/etc/fstab
packages +=
# dependencies to build a SlapOS SR without slapos-node
  ca-certificates file g++ libc6-dev make patch python
# speed up build by using the following components from the OS
  git liblzma-dev libssl-dev pkg-config python-dev
# extra requirements for NEO
  libnetfilter-queue-dev nftables
# extra requirements for this SR
  screen xz-utils

[versions]
slapos.recipe.template = 4.4
