Commit a12cd57d authored by Boxiang Sun's avatar Boxiang Sun

erp5testnode: Use nxdtest in depoy-test

parent bbd44c6d
...@@ -18,4 +18,4 @@ md5sum = 8357771b70efd0740561b1cb46f6955e ...@@ -18,4 +18,4 @@ md5sum = 8357771b70efd0740561b1cb46f6955e
[template-deploy-test] [template-deploy-test]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = c5db797980951b764b69aaa4b60a0380 # md5sum = c5db797980951b764b69aaa4b60a0380
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
The test_type = "{{ test_type }}" is unsupported. The test_type = "{{ test_type }}" is unsupported.
{% endif -%} {% endif -%}
[buildout] [buildout]
eggs-directory = {{ eggs_directory }} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
...@@ -69,3 +68,5 @@ tmp = ${:home}/tmp/ ...@@ -69,3 +68,5 @@ tmp = ${:home}/tmp/
log = ${:var}/log/ log = ${:var}/log/
services = ${:etc}/service/ services = ${:etc}/service/
scripts = ${:etc}/run/ scripts = ${:etc}/run/
test-working-dir = ${:home}/tmp
nxdtest-working-dir = ${:var}/nxdtest
\ No newline at end of file
[buildout] [buildout]
extends = ${template:output} extends =
${nxdtest-instance.cfg:output}
${template:output}
parts += parts +=
runTestSuite runTestSuite
copy-test-data copy-test-data
publish
[copy-test-data] [copy-test-data]
# Note: This is a hack, as such while requesting KVM it is not possible # Note: This is a hack, as such while requesting KVM it is not possible
...@@ -23,17 +26,29 @@ command = ...@@ -23,17 +26,29 @@ command =
cp ${standalone-local-playbook:location} $dest/standalone-local-playbook cp ${standalone-local-playbook:location} $dest/standalone-local-playbook
fi fi
[runTestSuite] [deploy-test-nxdtest-environment.sh]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
rendered = $${buildout:directory}/bin/$${:_buildout_section_name_} rendered = $${buildout:directory}/etc/${:_buildout_section_name_}
template = inline: template = inline:
#!/bin/sh export PATH=$${buildout:bin-directory}:/usr/bin/:/bin
export PATH=${python2.7-with-eggs:location}:$PATH export SLAPOS_TEST_WORKING_DIR=$${buildout:directory}/tmp
exec ${buildout:bin-directory}/${runTestSuite_py:interpreter} ${:_profile_base_location_}/runTestSuite.py --partition_ipv4 {{ list(partition_ipv4)[0] }} --partition_path $${buildout:directory} --test_reference "{{ slapparameter_dict.get('image-to-test-url') }} {{ slapparameter_dict.get('script-to-test-url')}}" --test_location "${test-location:base}/{{ slapparameter_dict.get('test-relative-directory', 'playbook/roles/standalone-shared') }}" --python_interpreter=${buildout:bin-directory}/${runTestSuite_py:interpreter} "$@" export SLAPOS_TEST_LOG_DIRECTORY=$${buildout:directory}/var/log
mode = 0755
context = [deploy-test-dot-nxdtest]
key slapparameter_dict slap-configuration:configuration recipe = slapos.recipe.template:jinja2
key partition_ipv4 slap-configuration:ipv4 rendered = $${buildout:directory}/var/nxdtest/.nxdtest
workdir = $${buildout:directory}/var/nxdtest
template = inline:
TestCase(
"deploy-test",
['python', '-m', 'unittest', 'discover', '-v'],
cwd="""$${buildout:directory}/test""",
summaryf=UnitTest.summary,
)
[runTestSuite]
env.sh = $${deploy-test-nxdtest-environment.sh:rendered}
workdir = $${deploy-test-dot-nxdtest:workdir}
[switch_softwaretype] [switch_softwaretype]
default = $${:deploy-test} default = $${:deploy-test}
...@@ -53,3 +68,18 @@ context = ...@@ -53,3 +68,18 @@ context =
raw waittime ${deploy-script-controller-script:waittime} raw waittime ${deploy-script-controller-script:waittime}
raw tries ${deploy-script-controller-script:tries} raw tries ${deploy-script-controller-script:tries}
mode = 0644 mode = 0644
[slapos-local-development-environment.sh]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/etc/${:_buildout_section_name_}
template = inline:
source $${deploy-test-nxdtest-environment.sh:rendered}
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
environment-script = $${slapos-local-development-environment.sh:rendered}
...@@ -2,18 +2,12 @@ ...@@ -2,18 +2,12 @@
extends = extends =
buildout.hash.cfg buildout.hash.cfg
https://lab.nexedi.com/nexedi/slapos/raw/1.0.232/software/kvm/software.cfg https://lab.nexedi.com/nexedi/slapos/raw/1.0.232/software/kvm/software.cfg
../../../../stack/nxdtest.cfg
parts = parts =
python-with-eggs python-with-eggs
template-deploy-test template-deploy-test
runTestSuite_py
playbook playbook
[runTestSuite_py]
recipe = zc.recipe.egg
eggs =
erp5.util
interpreter = ${:_buildout_section_name_}
[python2.7-with-eggs] [python2.7-with-eggs]
# create interpreters named "python" and "python2.7" so that # create interpreters named "python" and "python2.7" so that
# instance profile can use them in $PATH # instance profile can use them in $PATH
...@@ -69,4 +63,4 @@ location = ${:_profile_base_location_}/${:filename} ...@@ -69,4 +63,4 @@ location = ${:_profile_base_location_}/${:filename}
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
mode = 0644 mode = 640
\ No newline at end of file
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