On (21/09/16 11:43), Lukas Slebodnik wrote: >On (19/09/16 12:11), Jakub Hrozek wrote: >>On Mon, Sep 19, 2016 at 10:41:13AM +0200, Lukas Slebodnik wrote: >>> On (19/09/16 10:06), Lukas Slebodnik wrote: >>> >On (12/09/16 00:25), Jakub Hrozek wrote: >>> >>From fd71b7ed7c588cc22402573b9877020234949e22 Mon Sep 17 00:00:00 2001 >>> >>From: Jakub Hrozek <jhro...@redhat.com> >>> >>Date: Fri, 9 Sep 2016 12:23:04 +0200 >>> >>Subject: [PATCH 3/3] TESTS: Test offline netgroups resolution >>> >> >>> >>--- >>> >> src/tests/intg/test_netgroup.py | 35 +++++++++++++++++++++++++++++------ >>> >> 1 file changed, 29 insertions(+), 6 deletions(-) >>> >> >>> >>diff --git a/src/tests/intg/test_netgroup.py >>> >>b/src/tests/intg/test_netgroup.py >>> >>index >>> >>b99476126844e35d5dbc1793077720b4020c2fb7..1d00f0ecdc912dc7ecc23a818a79828d2b2727e6 >>> >> 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: >>> >>@@ -172,6 +178,9 @@ def create_sssd_cleanup(request): >>> >> """Add teardown for stopping SSSD and removing its state""" >>> >> 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""" >>> >>@@ -351,7 +360,7 @@ def test_remove_step_by_step(remove_step_by_step, >>> >>ldap_conn): >>> >> ent_list.remove(ent_list[0]) >>> >> >>> >> if subprocess.call(["sss_cache", "-N"]) != 0: >>> >>- raise Exception("sssd_cache failed") >>> >>+ raise Exception("sss_cache failed") >>> >> >>> >> res, _, netgroups = >>> >> sssd_netgroup.get_sssd_netgroups("rm_empty_netgroup1") >>> >> assert res == sssd_netgroup.NssReturnCode.NOTFOUND >>> >>@@ -366,7 +375,7 @@ def test_remove_step_by_step(remove_step_by_step, >>> >>ldap_conn): >>> >> ent_list.remove(ent_list[0]) >>> >> >>> >> if subprocess.call(["sss_cache", "-N"]) != 0: >>> >>- raise Exception("sssd_cache failed") >>> >>+ raise Exception("sss_cache failed") >>> >> >>> >> res, _, netgroups = >>> >> sssd_netgroup.get_sssd_netgroups("rm_empty_netgroup1") >>> >> assert res == sssd_netgroup.NssReturnCode.NOTFOUND >>> >>@@ -422,7 +431,7 @@ def >>> >>test_removing_nested_netgroups(removing_nested_netgroups, ldap_conn): >>> >> ldap_conn.modify_s(netgrp_dn, ldif) >>> >> >>> >> if subprocess.call(["sss_cache", "-N"]) != 0: >>> >>- raise Exception("sssd_cache failed") >>> >>+ raise Exception("sss_cache failed") >>> >> >>> >> res, _, netgroups = >>> >> sssd_netgroup.get_sssd_netgroups("t2841_netgroup1") >>> >> assert res == sssd_netgroup.NssReturnCode.SUCCESS >>> >>@@ -444,7 +453,7 @@ def >>> >>test_removing_nested_netgroups(removing_nested_netgroups, ldap_conn): >>> >> ldap_conn.modify_s(netgrp_dn, ldif) >>> >> >>> >> if subprocess.call(["sss_cache", "-N"]) != 0: >>> >>- raise Exception("sssd_cache failed") >>> >>+ raise Exception("sss_cache failed") >>> >Above changes are unrelated to the test. >>> >If you decide to touch the code then it would be better >>> >to use subprocess.check_call >>> > >>> > >>> >> >>> >> res, _, netgroups = >>> >> sssd_netgroup.get_sssd_netgroups("t2841_netgroup1") >>> >> assert res == sssd_netgroup.NssReturnCode.SUCCESS >>> >>@@ -457,3 +466,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")] >>> >>+ >>> >>+ if subprocess.call(["sss_cache", "-N"]) != 0: >>> >>+ raise Exception("sss_cache failed") >>> >>+ >>> >>+ simulate_offline() >>> >>+ >>> >>+ res, _, netgrps = >>> >>sssd_netgroup.get_sssd_netgroups("tripled_netgroup") >>> >>+ assert res == sssd_netgroup.NssReturnCode.SUCCESS >>> >>+ assert netgrps == [("host", "user", "domain")] >>> > >>> >otherwise LGTM >>> > >>> Actually, there are trivial pep8 errors >>> src/tests/intg/test_netgroup.py:181:1: E302 expected 2 blank lines, found 1 >>> src/tests/intg/test_netgroup.py:185:1: E302 expected 2 blank lines, found 1 >>> src/tests/intg/test_netgroup.py:470:1: E302 expected 2 blank lines, found 1 >> >>OK, see the new patches. > >ACK > >http://sssd-ci.duckdns.org/logs/job/53/68/summary.html > master: * c0ee12832555b42c17e48cdf731731454a97972e * a3108c5cd1ebb05c133c8e8990278ac4f4b8e25c * b9e155da725e711ab306ca8a96e3ba6fbda41a3a
sssd-1-13: * faaa6645a28b56175569cbee135da3ccfcad3594 * f557e46b66c742d97525153a3755ace307611f34 LS _______________________________________________ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org