sssd/0071-TESTS-Test-offline-netgroups-resolution.patch
Lukas Slebodnik 640e44ca24 Fix regression with krb5_map_user
- Resolves: rhbz#1375552 - krb5_map_user doesn't seem effective anymore
- Resolves: rhbz#1349286 - authconfig fails with SSSDConfig.NoDomainError:
                           default if nonexistent domain is mentioned
2016-09-22 22:28:47 +02:00

79 lines
2.6 KiB
Diff

From 39ab6bfc8f822c77144d0056bb87b82ca3e8af3e Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Fri, 9 Sep 2016 12:23:04 +0200
Subject: [PATCH 71/79] TESTS: Test offline netgroups resolution
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
(cherry picked from commit c0ee12832555b42c17e48cdf731731454a97972e)
---
src/tests/intg/test_netgroup.py | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/tests/intg/test_netgroup.py b/src/tests/intg/test_netgroup.py
index b99476126844e35d5dbc1793077720b4020c2fb7..f1d801f48a954baf4d244ec533348a1de2f2d2c8 100644
--- a/src/tests/intg/test_netgroup.py
+++ b/src/tests/intg/test_netgroup.py
@@ -104,6 +104,7 @@ def format_basic_conf(ldap_conn, schema):
[sssd]
domains = LDAP
services = nss
+ disable_netlink = true
[domain/LDAP]
{schema_conf}
@@ -148,11 +149,16 @@ def create_sssd_process():
raise Exception("sssd start failed")
+def get_sssd_pid():
+ pid_file = open(config.PIDFILE_PATH, "r")
+ pid = int(pid_file.read())
+ return pid
+
+
def cleanup_sssd_process():
"""Stop the SSSD process and remove its state"""
try:
- pid_file = open(config.PIDFILE_PATH, "r")
- pid = int(pid_file.read())
+ pid = get_sssd_pid()
os.kill(pid, signal.SIGTERM)
while True:
try:
@@ -173,6 +179,11 @@ def create_sssd_cleanup(request):
request.addfinalizer(cleanup_sssd_process)
+def simulate_offline():
+ pid = get_sssd_pid()
+ os.kill(pid, signal.SIGUSR1)
+
+
def create_sssd_fixture(request):
"""Start SSSD and add teardown for stopping it and removing its state"""
create_sssd_process()
@@ -457,3 +468,17 @@ def test_removing_nested_netgroups(removing_nested_netgroups, ldap_conn):
res, _, netgroups = sssd_netgroup.get_sssd_netgroups("t2841_netgroup3")
assert res == sssd_netgroup.NssReturnCode.SUCCESS
assert netgroups == []
+
+
+def test_offline_netgroups(add_tripled_netgroup):
+ res, _, netgrps = sssd_netgroup.get_sssd_netgroups("tripled_netgroup")
+ assert res == sssd_netgroup.NssReturnCode.SUCCESS
+ assert netgrps == [("host", "user", "domain")]
+
+ subprocess.check_call(["sss_cache", "-N"])
+
+ simulate_offline()
+
+ res, _, netgrps = sssd_netgroup.get_sssd_netgroups("tripled_netgroup")
+ assert res == sssd_netgroup.NssReturnCode.SUCCESS
+ assert netgrps == [("host", "user", "domain")]
--
2.9.3