diff options
| author | Lukas Slebodnik <lslebodn@redhat.com> | 2015-11-06 11:37:54 +0100 |
|---|---|---|
| committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-11-11 18:05:38 +0100 |
| commit | b28f5fb097e06a97a45e0ae348e506d9d1432cc8 (patch) | |
| tree | 55b4990e45a2c40089363ac070236aefeb1f65d7 | |
| parent | c269ca2669706bddb25c5938b50277b0c0a94ea4 (diff) | |
| download | sssd-b28f5fb097e06a97a45e0ae348e506d9d1432cc8.tar.gz sssd-b28f5fb097e06a97a45e0ae348e506d9d1432cc8.tar.xz sssd-b28f5fb097e06a97a45e0ae348e506d9d1432cc8.zip | |
test_memory_cache: Test removing mc without invalidation
Long living clients should be able to reinitialize
memory cache which was removed but it not initialized.
This patch also remove workaround in test_local_domain.py
Test for:
https://fedorahosted.org/sssd/ticket/2726
Reviewed-by: Michal Židek <mzidek@redhat.com>
| -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) |
