Commit 5e0cdf6f authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

slapos-sr-testing: Add instance parameters to filter what is tested

See merge request !1011
parents 1a1efa41 c2856de1
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 5d1320a9b1d2828f2870e3096f1c2bfb md5sum = 733643122fb75dfd7374b973a95fa2ea
...@@ -4,7 +4,7 @@ parts += ...@@ -4,7 +4,7 @@ parts +=
publish publish
[slap-configuration] [slap-configuration]
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration.serialised
computer = ${slap-connection:computer-id} computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id} partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url} url = ${slap-connection:server-url}
...@@ -40,15 +40,34 @@ template = inline: ...@@ -40,15 +40,34 @@ template = inline:
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
rendered = ${:workdir}/.nxdtest rendered = ${:workdir}/.nxdtest
workdir = ${directory:nxdtest-working-dir} workdir = ${directory:nxdtest-working-dir}
template = inline: tests = {{ tests | indent(2) }}
{% for test in tests.splitlines() %} template =
TestCase( inline:{% raw %}
{{ repr(test.split()[0]) }}, {%- set only_sr = slapparameter_dict.get('only-sr') %}
[ {{ repr(interpreter) }}, '-m', 'unittest', 'discover', '-v'], {%- if not isinstance(only_sr, list) %}
cwd={{ repr(test.split()[1]) }}, {%- set only_sr = [only_sr] %}
summaryf=UnitTest.summary, {%- endif %}
) {%- set unittest_args = slapparameter_dict.get('unittest-args', ['discover', '-v']) %}
{% endfor %} {%- if not isinstance(unittest_args, list) %}
{%- set unittest_args = [unittest_args] %}
{%- endif %}
command = {{ repr([interpreter, '-m', 'unittest'] + unittest_args) }}
{%- for test in tests.splitlines() %}
{%- set name, folder = test.split() %}
{%- if not only_sr or name in only_sr %}
TestCase(
{{ repr(name) }},
command,
cwd={{ repr(folder) }},
summaryf=UnitTest.summary,
)
{%- endif %}
{%- endfor %}
{%- endraw %}
context =
key slapparameter_dict slap-configuration:configuration
key tests :tests
raw interpreter {{ interpreter }}
[runTestSuite] [runTestSuite]
env.sh = ${slapos-test-runner-nxdtest-environment.sh:rendered} env.sh = ${slapos-test-runner-nxdtest-environment.sh:rendered}
......
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