Commit 0dd3e119 authored by Kirill Smelkov's avatar Kirill Smelkov

stack/nxdtest

Currently Nexedi takes mostly a copy-paste approach when it comes to
organizing bin/runTestSuite and an instance to run this inside testnode:

    kirr@deco:~/src/wendelin/slapos/slapos-master$ git ls-files |grep runTestSuite
    software/build-rina/runTestSuite.in
    software/buildout-testing/runTestSuite.in
    software/cython-test/runTestSuite.in
    software/erp5testnode/testsuite/deploy-test/runTestSuite.py
    software/jstestnode/runTestSuite.in
    software/neoppod/runTestSuite.in
    software/neoppod/stress-testing/runTestSuite.in
    software/unstable/pyodide/runTestSuite.in

and adding new tests to be run this way will only increase the entropy.

Let's stop this, at least for new tests, and use a uniform approach without copying:

1) I've created nxdtest tool[1] which allows a project to specify in
   declarative way how to test itself: given such declaration nxdtest
   takes on itself the responsibility to communicate with testnode
   master, to drive test commands spawning etc, and leaves to the
   project only semantic part that is specific to the particular
   project.

   Nxdtest is based on my go/neo/t/nxd/runTestSuite[2,3] and on the code
   I've seen elsewhere scattered in other runTestSuite.in files.

2) Let's add stack/nxdtest.cfg to SlapOS that provides easy way for a
   software or component to organize testing of itself.

This patch adds stack/nxdtest and migrates software/neotest to use it
(because stack/nxdtest is based on it and this way it helps to track the
changes).

In the following patches we will add testing support for pygolang,
zodbtools and wendelin.core .

[1] https://lab.nexedi.com/kirr/nxdtest/blob/master/nxdtest
[2] kirr/neo@51b18490
[3] kirr/neo@f67c147d
parent fee8b968
......@@ -19,11 +19,3 @@ md5sum = bd46e95f1cea62c3b0082fe8c0c9c90b
[neotest]
filename = neotest.in
md5sum = fb3b4109128c1db1739ef5bb6abd1d94
[neotest-runTestSuite]
filename = neotest-runTestSuite.in
md5sum = 6a4281730b68cdba5c873817a6754428
[instance.cfg]
filename = instance.cfg.in
md5sum = 8a40d365c85d70f057ce997405ac3e88
#!/bin/bash -e
# neotest's runTestSuite wraper so it could be run without any environment preset
. ${buildout:directory}/neotest-env.sh
exec ${gowork:src}/lab.nexedi.com/kirr/neo/go/neo/t/nxd/runTestSuite "$@"
......@@ -18,6 +18,7 @@ extends =
../../component/coreutils/buildout.cfg
../../component/util-linux/buildout.cfg
../../component/pygolang/buildout.cfg
../../stack/nxdtest.cfg
parts =
......@@ -38,7 +39,6 @@ parts =
neotest-env.sh
neotest
neotest-runTestSuite
# for instance
slapos-cookbook
......@@ -75,23 +75,28 @@ output = ${buildout:directory}/${:_buildout_section_name_}
output = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
[neotest-runTestSuite]
<= buildout-template
output = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
# instance
[jinja2-template]
recipe = slapos.recipe.template:jinja2
template= ${:_profile_base_location_}/${:filename}
rendered= ${buildout:directory}/${:_buildout_section_name_}
mode = 0644
context =
section buildout buildout
# instance to run nxdtest.
[instance.cfg]
<= jinja2-template
template = inline:
[buildout]
extends = ${nxdtest-instance.cfg:rendered}
parts += tnxdtest
[runTestSuite]
env.sh = ${neotest-env.sh:output}
workdir = $${directory:t}
[directory]
t = $${:home}/t
# instance/t/.nxdtest -> .nxdtest inside go/neo
[tnxdtest]
recipe = plone.recipe.command
stop-on-error = yes
command = ln -s -t $${directory:t} ${gowork:src}/lab.nexedi.com/kirr/neo/go/neo/t/.nxdtest
# eggs:
......@@ -106,10 +111,10 @@ eggs =
wendelin.core
# for ZEO scripts (runzeo)
${ZEO:egg}
# for nxd/runTestSuite
erp5.util
# for e.g. tcpu.py
${pygolang:egg}
# for instance
plone.recipe.command
# wendelin.core: latest not yet released
......
# Stack for creating testnode instances to be run via nxdtest on Nexedi testing
# infrastructure.
#
# Usage:
#
# ---- 8< ---- (<software>/test.cfg)
# [buildout]
# extends = .../stack/nxdtest.cfg
#
# parts =
# ...
#
# # for instance
# slapos-cookbook
# instance.cfg
#
# ...
#
# [instance.cfg]
# <= jinja2-template
# template = inline:
# [buildout]
# extends = ${nxdtest-instance.cfg:rendered}
#
# [runTestSuite]
# env.sh = ...
# workdir = ...
#
# Created instance will have bin/runTestSuite that sources env.sh and runs
# nxdtest in workdir.
[buildout]
extends =
slapos.cfg
../component/git/buildout.cfg
nxdtest/buildout.hash.cfg
[jinja2-template]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:filename}
rendered = ${buildout:directory}/${:_buildout_section_name_}
mode = 0644
context =
section buildout buildout
[nxdtest-instance.cfg]
<= jinja2-template
template = ${:_profile_base_location_}/nxdtest/${:filename}
# NOTE += does not work
context =
section buildout buildout
section nxdtest nxdtest
[nxdtest]
recipe = zc.recipe.egg:scripts
eggs = ${nxdtest-egg:egg}
scripts = nxdtest
# convenience for nxdtest users
exe = ${buildout:bin-directory}/nxdtest
[nxdtest-egg]
recipe = zc.recipe.egg:develop
setup = ${nxdtest-repository:location}
egg = nxdtest
[nxdtest-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/kirr/nxdtest.git
revision = bd91f6f1579a
location = ${buildout:parts-directory}/nxdtest
git-executable = ${git:location}/bin/git
[versions]
slapos.recipe.template = 4.4
# THIS IS NOT A BUILDOUT FILE ... -> use update-hash to update it.
[nxdtest-instance.cfg]
filename = instance.cfg.in
md5sum = ea54ba85655f52ce491c84450400e5af
# NEO test instance: run neotest under Nexedi testing infrastructure
# instance to test a software via nxdtest under Nexedi testing infrastructure.
[buildout]
parts = runTestSuite
......@@ -17,12 +17,17 @@ bin = {{ buildout['bin-directory'] }}
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
bin = ${:home}/bin
neotest = ${:home}/neotest
# script to run the testsuite from inside <instance>/neotest/
# script to run the testsuite via nxdtest
# located @ <instance>/bin/runTestSuite so testnode can see this as run tests entrypoint.
#
# instance that uses stack/nxdtest.cfg must provide
#
# [runTestSuite]
# env.sh = ...
# workdir = ...
[runTestSuite]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/${:_buildout_section_name_}
command-line = /bin/bash -c 'cd ${directory:neotest} && ${software:bin}/neotest-runTestSuite "$@"' runTestSuite
command-line = /bin/bash -c '. ${:env.sh} && cd ${:workdir} && {{ nxdtest['exe'] }} "$@"' nxdtest
# "$@" is implicitly added to argv
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