diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/tests/intg/test_local_domain.py | 6 | ||||
| -rw-r--r-- | src/tests/intg/test_memory_cache.py | 36 |
2 files changed, 38 insertions, 4 deletions
diff --git a/src/tests/intg/test_local_domain.py b/src/tests/intg/test_local_domain.py index c62de16c..4de0f5da 100644 --- a/src/tests/intg/test_local_domain.py +++ b/src/tests/intg/test_local_domain.py @@ -61,10 +61,8 @@ def create_sssd_fixture(request): subprocess.call(["sss_cache", "-E"]) for path in os.listdir(config.DB_PATH): os.unlink(config.DB_PATH + "/" + path) - # FIXME: Uncomment this when ticket #2726 is solved - # https://fedorahosted.org/sssd/ticket/2726 - # for path in os.listdir(config.MCACHE_PATH): - # os.unlink(config.MCACHE_PATH + "/" + path) + for path in os.listdir(config.MCACHE_PATH): + os.unlink(config.MCACHE_PATH + "/" + path) request.addfinalizer(teardown) diff --git a/src/tests/intg/test_memory_cache.py b/src/tests/intg/test_memory_cache.py index a8d6d8f5..c88bd896 100644 --- a/src/tests/intg/test_memory_cache.py +++ b/src/tests/intg/test_memory_cache.py @@ -743,3 +743,39 @@ def test_invalidate_everything_after_stop(ldap_conn, sanity_rfc2307): subprocess.call(["sss_cache", "-E"]) assert_missing_mc_records_for_user1() + + +def test_removed_mc(ldap_conn, sanity_rfc2307): + """ + Regression test for ticket: + https://fedorahosted.org/sssd/ticket/2726 + """ + + ent.assert_passwd_by_name( + 'user1', + dict(name='user1', passwd='*', uid=1001, gid=2001, + gecos='1001', shell='/bin/bash')) + ent.assert_passwd_by_uid( + 1001, + dict(name='user1', passwd='*', uid=1001, gid=2001, + gecos='1001', shell='/bin/bash')) + + ent.assert_group_by_name("group1", dict(name="group1", gid=2001)) + ent.assert_group_by_gid(2001, dict(name="group1", gid=2001)) + stop_sssd() + + # remove cache without invalidation + for path in os.listdir(config.MCACHE_PATH): + os.unlink(config.MCACHE_PATH + "/" + path) + + # sssd is stopped; so the memory cache should not be used + # in long living clients (py.test in this case) + with pytest.raises(KeyError): + pwd.getpwnam('user1') + with pytest.raises(KeyError): + pwd.getpwuid(1001) + + with pytest.raises(KeyError): + grp.getgrnam('group1') + with pytest.raises(KeyError): + grp.getgrgid(2001) |
