diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2016-09-09 12:23:04 +0200 |
---|---|---|
committer | Lukas Slebodnik <lslebodn@redhat.com> | 2016-09-21 10:13:45 +0200 |
commit | c0ee12832555b42c17e48cdf731731454a97972e (patch) | |
tree | bf067df40dd5cb1fae9a6067c38962c0e8a4f422 | |
parent | a3108c5cd1ebb05c133c8e8990278ac4f4b8e25c (diff) | |
download | sssd-c0ee12832555b42c17e48cdf731731454a97972e.tar.gz sssd-c0ee12832555b42c17e48cdf731731454a97972e.tar.xz sssd-c0ee12832555b42c17e48cdf731731454a97972e.zip |
TESTS: Test offline netgroups resolution
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
-rw-r--r-- | src/tests/intg/test_netgroup.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/tests/intg/test_netgroup.py b/src/tests/intg/test_netgroup.py index b99476126..f1d801f48 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")] |