Commit a131b63a authored by zhifan huang's avatar zhifan huang Committed by Xiaowu Zhang

slapos-testing: add re6stnet tests

use unshare to create new user-root namesapce to have the perrmission to
create network device, use mount to update files information of network
device in /sys(nemu)
test use iptables to manage route condition, miniupnpd to manage upnp,
brctl(nemu) to create bridge, so add them in component.

add openvpn, add babel, modify ovpn-client/server

due to outdated pypi version, nemu don't include need moudle in
setup.py, so add them in buildout
parent 684e8505
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 3112bf86fa543df52548a551f5413f99 md5sum = 446cbfe05097bf03f6b4de742fa8ab28
...@@ -87,12 +87,26 @@ repository = ${slapos.rebootstrap-repository:location} ...@@ -87,12 +87,26 @@ repository = ${slapos.rebootstrap-repository:location}
<= download-source <= download-source
repository = ${rubygemsrecipe-repository:location} repository = ${rubygemsrecipe-repository:location}
[re6stnet]
<= download-source
repository = ${re6stnet-repository:location}
[re6stnet-test-runner]
recipe = slapos.recipe.template:jinja2
template = inline:#!/bin/sh
#change #!/usr/bin/python2 -> #!/real_python_path/bin/python2
sed '1s?/usr/bin/python2?${python2.7:location}/bin/python2?' -i ${re6stnet-repository:location}/re6st/ovpn-*
# update files in /sys/class/net
mount -t sysfs sysfs /sys
python -m unittest discover -v
rendered = $${re6stnet:location}/test-runner.sh
[slapos-test-runner-nxdtest-environment.sh] [slapos-test-runner-nxdtest-environment.sh]
recipe = slapos.recipe.template recipe = slapos.recipe.template
output = $${create-directory:etc}/$${:_buildout_section_name_} output = $${create-directory:etc}/$${:_buildout_section_name_}
inline = inline =
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 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/:${iptables:location}/sbin:${miniupnpd:location}/usr/sbin:${brctl:location}/sbin:${openvpn:location}/sbin:${babeld:location}/bin:${buildout:bin-directory}:$PATH
export SLAPOS_TEST_IPV4=$${slap-configuration:ipv4-random} export SLAPOS_TEST_IPV4=$${slap-configuration:ipv4-random}
export SLAPOS_TEST_IPV6=$${slap-configuration:ipv6-random} export SLAPOS_TEST_IPV6=$${slap-configuration:ipv6-random}
export SLAPOS_TEST_EGGS_DIRECTORY=$${buildout:eggs-directory} export SLAPOS_TEST_EGGS_DIRECTORY=$${buildout:eggs-directory}
...@@ -199,6 +213,13 @@ inline = ...@@ -199,6 +213,13 @@ inline =
cwd="""$${rubygemsrecipe:location}""", cwd="""$${rubygemsrecipe:location}""",
summaryf=UnitTest.summary, summaryf=UnitTest.summary,
) )
TestCase(
"re6stnet",
['unshare', '-Umnr', '$${re6stnet-test-runner:rendered}'],
cwd="""$${re6stnet:location}/re6st/tests""",
summaryf=UnitTest.summary,
)
[runTestSuite] [runTestSuite]
env.sh = $${slapos-test-runner-nxdtest-environment.sh:output} env.sh = $${slapos-test-runner-nxdtest-environment.sh:output}
......
...@@ -19,6 +19,11 @@ extends = ...@@ -19,6 +19,11 @@ extends =
../../component/userhosts/buildout.cfg ../../component/userhosts/buildout.cfg
../../component/postgresql/buildout.cfg ../../component/postgresql/buildout.cfg
../../component/psycopg2/buildout.cfg ../../component/psycopg2/buildout.cfg
../../component/nftables/buildout.cfg
../../component/miniupnpd/buildout.cfg
../../component/openvpn/buildout.cfg
../../component/babeld/buildout.cfg
../../component/bridge-utils/buildout.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
../../stack/caucase/buildout.cfg ../../stack/caucase/buildout.cfg
../../stack/nxdtest.cfg ../../stack/nxdtest.cfg
...@@ -116,6 +121,11 @@ setup = ${slapos.rebootstrap-repository:location} ...@@ -116,6 +121,11 @@ setup = ${slapos.rebootstrap-repository:location}
egg = rubygemsrecipe[test] egg = rubygemsrecipe[test]
setup = ${rubygemsrecipe-repository:location} setup = ${rubygemsrecipe-repository:location}
[re6stnet-setup]
<= setup-develop-egg
egg = re6stnet[test]
setup = ${re6stnet-repository:location}
[eggs] [eggs]
<= python-interpreter <= python-interpreter
eggs += eggs +=
...@@ -140,8 +150,12 @@ eggs += ...@@ -140,8 +150,12 @@ eggs +=
${slapcache-setup:egg} ${slapcache-setup:egg}
${slapos.rebootstrap-setup:egg} ${slapos.rebootstrap-setup:egg}
${rubygemsrecipe-setup:egg} ${rubygemsrecipe-setup:egg}
${re6stnet-setup:egg}
zope.testing zope.testing
supervisor supervisor
pathlib2
python-unshare
python-passfd
[eggs/scripts] [eggs/scripts]
recipe = zc.recipe.egg recipe = zc.recipe.egg
...@@ -215,6 +229,10 @@ repository = https://lab.nexedi.com/nexedi/slapos.rebootstrap.git ...@@ -215,6 +229,10 @@ repository = https://lab.nexedi.com/nexedi/slapos.rebootstrap.git
<= git-clone-repository <= git-clone-repository
repository = https://lab.nexedi.com/nexedi/rubygemsrecipe.git repository = https://lab.nexedi.com/nexedi/rubygemsrecipe.git
[re6stnet-repository]
<= git-clone-repository
repository = https://lab.nexedi.com/nexedi/re6stnet.git
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
...@@ -253,3 +271,8 @@ zope.testing = 4.6.2 ...@@ -253,3 +271,8 @@ zope.testing = 4.6.2
pathlib = 1.0.1 pathlib = 1.0.1
psycopg2 = 2.8.6 psycopg2 = 2.8.6
iniparse = 0.5 iniparse = 0.5
miniupnpc = 1.9
nemu = 0.3.1
multiping = 1.1.2
python-passfd = 0.2
python-unshare = 0.2
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