instance.cfg 7.09 KB
Newer Older
1
[buildout]
2
extends = ${nxdtest-instance.cfg:output}
3
parts +=
4
  publish
5

6 7 8 9 10 11 12 13
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
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}

14 15
[create-directory]
recipe = slapos.cookbook:mkdirectory
16
bin = $${buildout:directory}/bin
17 18 19
etc = $${buildout:directory}/etc
services = $${:etc}/run
srv = $${buildout:directory}/srv
20 21
var = $${buildout:directory}/var
nxdtest-working-dir = $${:var}/nxdtest
Rafael Monnerat's avatar
Rafael Monnerat committed
22

23 24 25
[download-source]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
Rafael Monnerat's avatar
Rafael Monnerat committed
26

27 28 29 30
[kedifa]
<= download-source
repository = ${kedifa-repository:location}

31 32 33 34
[caucase]
<= download-source
repository = ${caucase-repository:location}

35
[caucase-test-runner]
36 37 38
recipe = slapos.recipe.template
inline =
  #!/bin/sh
39 40 41 42
  export HOSTS_FILE="$(mktemp)"
  trap 'rm "$HOSTS_FILE"' EXIT
  printf '%s testhost\n%s testhost\n' "$SLAPOS_TEST_IPV4" "$SLAPOS_TEST_IPV6" > "$HOSTS_FILE"
  export CAUCASE_NETLOC=testhost:8000 LD_PRELOAD=${userhosts:location}/lib/libuserhosts.so:$LD_PRELOAD
43
  exec python -m unittest discover -v
44
output = $${caucase:location}/host_setting.sh
45

46 47 48 49
[slapos.libnetworkcache]
<= download-source
repository = ${slapos.libnetworkcache-repository:location}

50 51 52 53
[slapcache]
<= download-source
repository = ${slapcache-repository:location}

54 55 56 57
[erp5.util]
<= download-source
repository = ${erp5.util-repository:location}

58 59 60 61
[slapos.cookbook]
<= download-source
repository = ${slapos.cookbook-repository:location}

62
[slapos.core]
Rafael Monnerat's avatar
Rafael Monnerat committed
63
<= download-source
64
repository = ${slapos.core-repository:location}
Rafael Monnerat's avatar
Rafael Monnerat committed
65

66 67 68 69
[slapos.recipe.build]
<= download-source
repository = ${slapos.recipe.build-repository:location}

70 71 72 73
[slapos.recipe.cmmi]
<= download-source
repository = ${slapos.recipe.cmmi-repository:location}

74
[slapos.recipe.template]
75
<= download-source
76
repository = ${slapos.recipe.template-repository:location}
77

78
[slapos.toolbox]
79
<= download-source
80
repository = ${slapos.toolbox-repository:location}
81

82 83 84 85
[slapos.rebootstrap]
<= download-source
repository = ${slapos.rebootstrap-repository:location}

86 87 88 89
[rubygemsrecipe]
<= download-source
repository = ${rubygemsrecipe-repository:location}

90

91
[slapos-test-runner-nxdtest-environment.sh]
92 93 94
recipe = slapos.recipe.template
output = $${create-directory:etc}/$${:_buildout_section_name_}
inline =
95
  export PATH=${coreutils:location}/bin:${curl:location}/bin:${openssl:location}/bin:${jq:location}/bin:${sed:location}/bin:${grep:location}/bin:${git:location}/bin:${libxslt:location}/bin:${socat:location}/bin:${lmsensors:location}/bin:${rsync:location}/bin/:${buildout:bin-directory}:$PATH
96 97
  export SLAPOS_TEST_IPV4=$${slap-configuration:ipv4-random}
  export SLAPOS_TEST_IPV6=$${slap-configuration:ipv6-random}
98 99
  export SLAPOS_TEST_EGGS_DIRECTORY=$${buildout:eggs-directory}
  export SLAPOS_TEST_DEVELOP_EGGS_DIRECTORY=$${buildout:develop-eggs-directory}
100
  export SLAPOS_TEST_POSTGRESQL_PREFIX=${postgresql:location}
101 102 103


[slapos-test-runner-dot-nxdtest]
104 105
recipe = slapos.recipe.template
output = $${:workdir}/.nxdtest
106
workdir = $${create-directory:nxdtest-working-dir}
107
inline =
108 109 110 111 112 113 114 115
  TestCase(
      "kedifa",
      ['python', '-m', 'unittest', 'discover', '-v'],
      cwd="""$${kedifa:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "caucase",
116
      ['$${caucase-test-runner:output}'],
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
      cwd="""$${caucase:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "erp5.util",
      ['python', '-m', 'unittest', 'discover', '-v', '--start', 'erp5/tests/'],
      cwd="""$${erp5.util:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.cookbook",
      # slapos/test contain both tests for recipes and tests for
      # json schemas, we only care about recipe tests here, json
      # schemas are tested in software/slapos-sr-testing
      ['python', '-m', 'unittest', 'discover', '-v', '--start', 'slapos/test/recipe'],
      cwd="""$${slapos.cookbook:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.core",
      # ['python', '-m', 'unittest', 'discover', '-v'],
      # XXX some test fail when running with unittest (slapos*.cfg.example
      # files cannot be found with pkg_resources.resource_string), so we keep
      # using setup.py test for now.
      ['python', 'setup.py', 'test'],
      cwd="""$${slapos.core:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.recipe.build",
      ['python', '-m', 'unittest', 'discover', '-v'],
      cwd="""$${slapos.recipe.build:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.recipe.cmmi",
      ['python', '-m', 'unittest', 'discover', '-v'],
      cwd="""$${slapos.recipe.cmmi:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.recipe.template",
      # ['python', '-m', 'unittest', 'slapos.recipe.template.tests.test_suite'],
      # XXX some test fail when running with unittest, so we keep using setup.py test
      ['python', 'setup.py', 'test'],
      cwd="""$${slapos.recipe.template:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.toolbox",
      # ['python', '-m', 'unittest', 'discover', '-v'],
      # XXX We can not just run unittest discover here, since slapos/lamp
      # imports MySQLDb and we currently don't have installed
      # slapos.toolbox[lampconfigure] and on python3 discovery make a
      # failing test for this import error.
      # Currently slapos/lamp is not tested, but if it it is still used,
      # the TODO seem to also install slapos.toolbox[lampconfigure] here.
      ['python', '-m', 'unittest', 'discover', '-v', '--start', 'slapos/test', '--top-level-directory', '.'],
      cwd="""$${slapos.toolbox:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "slapos.libnetworkcache",
      ['python', '-m', 'unittest', '-v', 'slapos.libnetworkcachetests'],
      cwd="""$${slapos.libnetworkcache:location}""",
      summaryf=UnitTest.summary,
183 184 185 186 187 188
  )
  TestCase(
      "slapcache",
      ['python', '-m', 'unittest', 'discover', '-v', '--start', 'slapcache/test'],
      cwd="""$${slapcache:location}""",
      summaryf=UnitTest.summary,
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
  )
  TestCase(
      "slapos.rebootstrap",
      ['python', '-m', 'unittest', '-v', 'slapos.rebootstrap.tests.test_suite'],
      cwd="""$${slapos.rebootstrap:location}""",
      summaryf=UnitTest.summary,
  )
  TestCase(
      "rubygemsrecipe",
      ['python', '-m', 'unittest', 'discover', '-v'],
      cwd="""$${rubygemsrecipe:location}""",
      summaryf=UnitTest.summary,
  )

[runTestSuite]
204
env.sh = $${slapos-test-runner-nxdtest-environment.sh:output}
205 206 207
workdir = $${slapos-test-runner-dot-nxdtest:workdir}

[slapos-local-development-environment.sh]
208 209 210 211
recipe = slapos.recipe.template
output = $${create-directory:etc}/$${:_buildout_section_name_}
inline =
  source $${slapos-test-runner-nxdtest-environment.sh:output}
212 213 214 215 216 217 218 219
  echo "Environment loaded."
  echo "To work on a test, execute:"
  echo "   $${runTestSuite:wrapper-path} -k test_name"
  echo "replacing test_name by the name of the test."
  echo

[publish]
recipe = slapos.cookbook:publish
220
environment-script = $${slapos-local-development-environment.sh:output}