summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick McLean <chutzpah@gentoo.org>2015-11-23 16:01:45 -0800
committerPatrick McLean <chutzpah@gentoo.org>2015-11-23 16:20:50 -0800
commit1d39672d822a884a29511da02b01c405cee9f8a5 (patch)
tree75722f935e1452e023f0a244f5d2c96001943600 /app-admin/salt
parentmedia-libs/libsndfile: Security bump to version 1.0.26 (bug #566680). (diff)
downloadgentoo-1d39672d822a884a29511da02b01c405cee9f8a5.tar.gz
gentoo-1d39672d822a884a29511da02b01c405cee9f8a5.tar.bz2
gentoo-1d39672d822a884a29511da02b01c405cee9f8a5.zip
app-admin/salt: update the tests in 2015.5.7
Package-Manager: portage-2.2.25
Diffstat (limited to 'app-admin/salt')
-rw-r--r--app-admin/salt/files/salt-2015.5.7-tmpdir.patch37
-rw-r--r--app-admin/salt/salt-2015.5.7.ebuild25
2 files changed, 57 insertions, 5 deletions
diff --git a/app-admin/salt/files/salt-2015.5.7-tmpdir.patch b/app-admin/salt/files/salt-2015.5.7-tmpdir.patch
new file mode 100644
index 000000000000..8a19c32e0f71
--- /dev/null
+++ b/app-admin/salt/files/salt-2015.5.7-tmpdir.patch
@@ -0,0 +1,37 @@
+diff --git a/tests/unit/modules/grains_test.py b/tests/unit/modules/grains_test.py
+index 3473c03..ea37d66 100644
+--- a/tests/unit/modules/grains_test.py
++++ b/tests/unit/modules/grains_test.py
+@@ -1,6 +1,8 @@
+ # -*- coding: utf-8 -*-
+
+ import copy
++import os.path
++import tempfile
+
+ # Import Salt Testing libs
+ from salttesting import TestCase, skipIf
+@@ -20,8 +22,8 @@ from salt.modules import grains as grainsmod
+ from salt.utils import dictupdate
+
+ grainsmod.__opts__ = {
+- 'conf_file': '/tmp/__salt_test_grains',
+- 'cachedir': '/tmp/__salt_test_grains_cache_dir'
++ 'conf_file': os.path.join(tempfile.gettempdir(), '__salt_test_grains'),
++ 'cachedir': os.path.join(tempfile.gettempdir(), '__salt_test_grains_cache_dir')
+ }
+
+ grainsmod.__salt__ = {}
+diff --git a/tests/unit/states/archive_test.py b/tests/unit/states/archive_test.py
+index 3cfb2f0..b3f3bee 100644
+--- a/tests/unit/states/archive_test.py
++++ b/tests/unit/states/archive_test.py
+@@ -69,7 +69,7 @@ class ArchiveTest(TestCase):
+ 'cmd.run_all': mock_run}):
+ filename = os.path.join(
+ tmp_dir,
+- 'files/test/_tmp_test_archive_.tar'
++ 'files/test/' + tempfile.gettempdir().replace('/', '_') + '_test_archive_.tar'
+ )
+ for test_opts, ret_opts in zip(test_tar_opts, ret_tar_opts):
+ ret = archive.extracted(tmp_dir,
diff --git a/app-admin/salt/salt-2015.5.7.ebuild b/app-admin/salt/salt-2015.5.7.ebuild
index a945709f955a..bf6c591a6b28 100644
--- a/app-admin/salt/salt-2015.5.7.ebuild
+++ b/app-admin/salt/salt-2015.5.7.ebuild
@@ -84,11 +84,13 @@ PATCHES=(
"${FILESDIR}/${PN}-2015.5.5-auth-tests.patch"
"${FILESDIR}/${PN}-2015.5.5-cron-tests.patch"
"${FILESDIR}/${PN}-2015.5.5-remove-buggy-tests.patch"
+ "${FILESDIR}/${PN}-2015.5.7-tmpdir.patch"
)
python_prepare() {
# this test fails because it trys to "pip install distribute"
- rm tests/unit/{modules,states}/zcbuildout_test.py tests/unit/modules/{rh_ip,win_network}_test.py \
+ rm tests/unit/{modules,states}/zcbuildout_test.py \
+ tests/unit/modules/{rh_ip,win_network}_test.py \
|| die "Failed to remove broken tests"
}
@@ -107,11 +109,24 @@ python_install_all() {
}
python_test() {
+ local tempdir
# testsuite likes lots of files
ulimit -n 3072
- # using ${T} for the TMPDIR makes some tests needs paths that exceed PATH_MAX
- USE_SETUPTOOLS=1 SHELL="/bin/bash" TMPDIR="/tmp" \
- ${EPYTHON} tests/runtests.py \
- --unit-tests --no-report --verbose || die "testing failed"
+ # ${T} is too long a path for the tests to work
+ tempdir="$(mktemp -dup /tmp salt-XXX)"
+ mkdir "${T}/$(basename "${tempdir}")"
+
+ (
+ cleanup() { rm -f "${tempdir}"; }
+ trap cleanup EXIT
+
+ addwrite "${tempdir}"
+ ln -s "$(realpath --relative-to=/tmp "${T}/$(basename "${tempdir}")")" "${tempdir}"
+
+ USE_SETUPTOOLS=1 SHELL="/bin/bash" TMPDIR="${tempdir}" \
+ ${EPYTHON} tests/runtests.py \
+ --unit-tests --no-report --verbose
+
+ ) || die "testing failed"
}