Commit b88dd5bf authored by Kirill Smelkov's avatar Kirill Smelkov

Merge branch 'master' into master+ZODB4-wc2

* master:
  fixup! wendelin.core: Add way to run tests
  Disable DBUS support for zbar as: - it's not used in a SlapOS system (seems only used for webcam support) - it breaks the concept of SlapOs containerization - finally it tries to create a DBUS file in /etc/dbus-1/system.d/ which is NOT   allowed (rightfully) for a slapsoft user
  caucase: set up a host file which specified for it
  software/slapos-testing: add jq, sed and grep in PATH
  software/erp5/test: fix ResourceWarning on python3
parents b2640909 a9ae5aa4
......@@ -14,6 +14,7 @@ extends =
parts =
# keep neoppod first and in parts so that ZODB is built correctly
neoppod-develop
neoppod
# for instance
......
......@@ -25,6 +25,7 @@ configure-options =
--without-python
--without-x
--without-jpg
--without-dbus
environment =
PATH=${autoconf:location}/bin:${automake:location}/bin:${gettext:location}/bin:${libtool:location}/bin:${m4:location}/bin:${bzip2:location}/bin:%(PATH)s
CFLAGS=
......@@ -110,6 +110,7 @@ class CaucaseService(ManagedResource):
'--netloc', backend_caucased_netloc,
'--service-auto-approve-count', '1',
],
# capture subprocess output not to pollute test's own stdout
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
......@@ -127,6 +128,7 @@ class CaucaseService(ManagedResource):
# type: () -> None
self._caucased_process.terminate()
self._caucased_process.wait()
self._caucased_process.stdout.close()
shutil.rmtree(self.directory)
......@@ -525,7 +527,7 @@ class TestHTTP(BalancerTestCase):
def test_keep_alive(self):
# type: () -> None
# when doing two requests, connection is established only once
session = requests.Session()
with requests.Session() as session:
session.verify = False
# do a first request, which establish a first connection
......@@ -539,6 +541,7 @@ class TestHTTP(BalancerTestCase):
new_conn.assert_not_called()
parsed_url = six.moves.urllib.parse.urlparse(self.default_balancer_url)
# check that we have an open file for the ip connection
self.assertTrue([
c for c in psutil.Process(os.getpid()).connections()
......
......@@ -64,7 +64,7 @@ class TestPublishedURLIsReachableMixin(object):
# erp5 site is not created, with 500 when mysql is not yet reachable, so we
# configure this requests session to retry.
# XXX we should probably add a promise instead
session = requests.Session()
with requests.Session() as session:
session.mount(
base_url,
requests.adapters.HTTPAdapter(
......
......@@ -15,4 +15,4 @@
[template]
filename = instance.cfg
md5sum = 2a82b7d5163d042e85b14a645707a093
md5sum = 84bd6729e9b299c457cea2d1be6d05a4
......@@ -32,6 +32,16 @@ repository = ${kedifa-repository:location}
<= download-source
repository = ${caucase-repository:location}
[caucase-test-runner]
recipe = slapos.recipe.template:jinja2
template = inline:#!/bin/sh
export HOSTS="$(mktemp)"
trap 'rm "$HOSTS"' EXIT
printf '%s testhost\n%s testhost\n' "$SLAPOS_TEST_IPV4" "$SLAPOS_TEST_IPV6" > "$HOSTS"
export CAUCASE_NETLOC=testhost:8000 LD_PRELOAD=${userhosts:location}/lib/userhosts.so:$LD_PRELOAD
exec python -m unittest discover -v
rendered = $${caucase:location}/host_setting.sh
[slapos.libnetworkcache]
<= download-source
repository = ${slapos.libnetworkcache-repository:location}
......@@ -77,7 +87,7 @@ repository = ${rubygemsrecipe-repository:location}
recipe = slapos.recipe.template:jinja2
rendered = $${create-directory:etc}/$${:_buildout_section_name_}
template = inline:
export PATH=${coreutils:location}/bin:${curl:location}/bin:${openssl: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/:${buildout:bin-directory}:$PATH
export SLAPOS_TEST_IPV4=$${slap-configuration:ipv4-random}
export SLAPOS_TEST_IPV6=$${slap-configuration:ipv6-random}
export SLAPOS_TEST_EGGS_DIRECTORY=$${buildout:eggs-directory}
......@@ -98,9 +108,7 @@ template = inline:
)
TestCase(
"caucase",
# XXX caucase uses 2to3 dynamically in setup.py, so it only supports
# runnning tests with python setup.py test
['python', 'setup.py', 'test'],
['$${caucase-test-runner:rendered}'],
cwd="""$${caucase:location}""",
summaryf=UnitTest.summary,
)
......
......@@ -13,6 +13,10 @@ extends =
../../component/socat/buildout.cfg
../../component/lmsensors/buildout.cfg
../../component/rsync/buildout.cfg
../../component/jq/buildout.cfg
../../component/sed/buildout.cfg
../../component/grep/buildout.cfg
../../component/userhosts/buildout.cfg
../../stack/slapos.cfg
../../stack/caucase/buildout.cfg
../../stack/nxdtest.cfg
......
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