sssd/0094-TESTS-Relax-the-assert-in-test_idle_timeout.patch
Lukas Slebodnik 8eda442b2e Fix few bugs/regressions
Resolves: rhbz#1488327 - SELinux is preventing selinux_child from write access
                         on the sock_file system_bus_socket
Resolves: rhbz#1490402 - SSSD does not create /var/lib/sss/deskprofile and
                         fails to download desktop profile data
Resolves: upstream#3485 - getsidbyid does not work with 1.15.3
Resolves: upstream#3488 - SUDO doesn't work for IPA users on IPA clients after
                          applying ID Views for them in IPA server
Resolves: upstream#3501 - Accessing IdM kerberos ticket fails while id mapping
                          is applied
2017-09-12 09:22:07 +02:00

80 lines
3.0 KiB
Diff

From 4d1e380fea70e917cdfba560b899cca2f3e2ffd1 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Tue, 29 Aug 2017 11:07:18 +0200
Subject: [PATCH 094/115] TESTS: Relax the assert in test_idle_timeout
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Resolves:
https://pagure.io/SSSD/sssd/issue/3473
We're being quite strict in test_idle_timeout when checking for the
number of open fds which leads to spurious failures like:
=================================== FAILURES ===================================
______________________________ test_idle_timeout _______________________________
Traceback (most recent call last):
File "/var/lib/jenkins/workspace/ci/label/fedora23/src/tests/intg/test_secrets.py", line 427, in test_idle_timeout
assert nfds_pre + 1 == nfds_conn
AssertionError: assert (27 + 1) == 27
==================== 1 failed, 221 passed in 473.37 seconds ====================
This is just a check that "a" connection was opened, so we don't have to
check for exact match, but just for larger-or-equal.
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
---
src/tests/intg/test_secrets.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/tests/intg/test_secrets.py b/src/tests/intg/test_secrets.py
index 15caa69582ea6fe5031df8150343412f0e68bd5e..a145045ee80c06a615c5746678075403df0c791b 100644
--- a/src/tests/intg/test_secrets.py
+++ b/src/tests/intg/test_secrets.py
@@ -360,9 +360,9 @@ def test_containers(setup_for_secrets, secrets_cli):
assert str(err406.value).startswith("406")
-def get_num_fds(pid):
+def get_fds(pid):
procpath = os.path.join("/proc/", str(pid), "fd")
- return len([fdname for fdname in os.listdir(procpath)])
+ return os.listdir(procpath)
@pytest.fixture
@@ -388,13 +388,14 @@ def test_idle_timeout(setup_for_cli_timeout_test):
secpid = setup_for_cli_timeout_test
sock_path = get_secrets_socket()
- nfds_pre = get_num_fds(secpid)
+ nfds_pre = get_fds(secpid)
sock = socket.socket(family=socket.AF_UNIX)
sock.connect(sock_path)
time.sleep(1)
- nfds_conn = get_num_fds(secpid)
- assert nfds_pre + 1 == nfds_conn
+ nfds_conn = get_fds(secpid)
+ if len(nfds_pre) + 1 < len(nfds_conn):
+ raise Exception("FD difference %s\n", set(nfds_pre) - set(nfds_conn))
# With the idle timeout set to 10 seconds, we need to sleep at least 15,
# because the internal timer ticks every timeout/2 seconds, so it would
# tick at 5, 10 and 15 seconds and the client timeout check uses a
@@ -402,8 +403,9 @@ def test_idle_timeout(setup_for_cli_timeout_test):
# disconnect
time.sleep(15)
- nfds_post = get_num_fds(secpid)
- assert nfds_pre == nfds_post
+ nfds_post = get_fds(secpid)
+ if len(nfds_pre) != len(nfds_post):
+ raise Exception("FD difference %s\n", set(nfds_pre) - set(nfds_post))
def run_quota_test(cli, max_secrets, max_payload_size):
--
2.14.1