Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/salt/, app-admin/salt/files/
Date: Tue, 24 Nov 2015 00:21:34
Message-Id: 1448324450.1d39672d822a884a29511da02b01c405cee9f8a5.chutzpah@gentoo
1 commit: 1d39672d822a884a29511da02b01c405cee9f8a5
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 24 00:01:45 2015 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 24 00:20:50 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d39672d
7
8 app-admin/salt: update the tests in 2015.5.7
9
10 Package-Manager: portage-2.2.25
11
12 app-admin/salt/files/salt-2015.5.7-tmpdir.patch | 37 +++++++++++++++++++++++++
13 app-admin/salt/salt-2015.5.7.ebuild | 25 +++++++++++++----
14 2 files changed, 57 insertions(+), 5 deletions(-)
15
16 diff --git a/app-admin/salt/files/salt-2015.5.7-tmpdir.patch b/app-admin/salt/files/salt-2015.5.7-tmpdir.patch
17 new file mode 100644
18 index 0000000..8a19c32
19 --- /dev/null
20 +++ b/app-admin/salt/files/salt-2015.5.7-tmpdir.patch
21 @@ -0,0 +1,37 @@
22 +diff --git a/tests/unit/modules/grains_test.py b/tests/unit/modules/grains_test.py
23 +index 3473c03..ea37d66 100644
24 +--- a/tests/unit/modules/grains_test.py
25 ++++ b/tests/unit/modules/grains_test.py
26 +@@ -1,6 +1,8 @@
27 + # -*- coding: utf-8 -*-
28 +
29 + import copy
30 ++import os.path
31 ++import tempfile
32 +
33 + # Import Salt Testing libs
34 + from salttesting import TestCase, skipIf
35 +@@ -20,8 +22,8 @@ from salt.modules import grains as grainsmod
36 + from salt.utils import dictupdate
37 +
38 + grainsmod.__opts__ = {
39 +- 'conf_file': '/tmp/__salt_test_grains',
40 +- 'cachedir': '/tmp/__salt_test_grains_cache_dir'
41 ++ 'conf_file': os.path.join(tempfile.gettempdir(), '__salt_test_grains'),
42 ++ 'cachedir': os.path.join(tempfile.gettempdir(), '__salt_test_grains_cache_dir')
43 + }
44 +
45 + grainsmod.__salt__ = {}
46 +diff --git a/tests/unit/states/archive_test.py b/tests/unit/states/archive_test.py
47 +index 3cfb2f0..b3f3bee 100644
48 +--- a/tests/unit/states/archive_test.py
49 ++++ b/tests/unit/states/archive_test.py
50 +@@ -69,7 +69,7 @@ class ArchiveTest(TestCase):
51 + 'cmd.run_all': mock_run}):
52 + filename = os.path.join(
53 + tmp_dir,
54 +- 'files/test/_tmp_test_archive_.tar'
55 ++ 'files/test/' + tempfile.gettempdir().replace('/', '_') + '_test_archive_.tar'
56 + )
57 + for test_opts, ret_opts in zip(test_tar_opts, ret_tar_opts):
58 + ret = archive.extracted(tmp_dir,
59
60 diff --git a/app-admin/salt/salt-2015.5.7.ebuild b/app-admin/salt/salt-2015.5.7.ebuild
61 index a945709..bf6c591 100644
62 --- a/app-admin/salt/salt-2015.5.7.ebuild
63 +++ b/app-admin/salt/salt-2015.5.7.ebuild
64 @@ -84,11 +84,13 @@ PATCHES=(
65 "${FILESDIR}/${PN}-2015.5.5-auth-tests.patch"
66 "${FILESDIR}/${PN}-2015.5.5-cron-tests.patch"
67 "${FILESDIR}/${PN}-2015.5.5-remove-buggy-tests.patch"
68 + "${FILESDIR}/${PN}-2015.5.7-tmpdir.patch"
69 )
70
71 python_prepare() {
72 # this test fails because it trys to "pip install distribute"
73 - rm tests/unit/{modules,states}/zcbuildout_test.py tests/unit/modules/{rh_ip,win_network}_test.py \
74 + rm tests/unit/{modules,states}/zcbuildout_test.py \
75 + tests/unit/modules/{rh_ip,win_network}_test.py \
76 || die "Failed to remove broken tests"
77 }
78
79 @@ -107,11 +109,24 @@ python_install_all() {
80 }
81
82 python_test() {
83 + local tempdir
84 # testsuite likes lots of files
85 ulimit -n 3072
86
87 - # using ${T} for the TMPDIR makes some tests needs paths that exceed PATH_MAX
88 - USE_SETUPTOOLS=1 SHELL="/bin/bash" TMPDIR="/tmp" \
89 - ${EPYTHON} tests/runtests.py \
90 - --unit-tests --no-report --verbose || die "testing failed"
91 + # ${T} is too long a path for the tests to work
92 + tempdir="$(mktemp -dup /tmp salt-XXX)"
93 + mkdir "${T}/$(basename "${tempdir}")"
94 +
95 + (
96 + cleanup() { rm -f "${tempdir}"; }
97 + trap cleanup EXIT
98 +
99 + addwrite "${tempdir}"
100 + ln -s "$(realpath --relative-to=/tmp "${T}/$(basename "${tempdir}")")" "${tempdir}"
101 +
102 + USE_SETUPTOOLS=1 SHELL="/bin/bash" TMPDIR="${tempdir}" \
103 + ${EPYTHON} tests/runtests.py \
104 + --unit-tests --no-report --verbose
105 +
106 + ) || die "testing failed"
107 }