URL: https://github.com/SSSD/sssd/pull/5719
Author: aborah-sudo
 Title: #5719: Tests: fix sss_cache to also reset cached timestamp
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/5719/head:pr5719
git checkout pr5719
From 44edf7df7908c3a7c0d7ef56b358c515f639d7d1 Mon Sep 17 00:00:00 2001
From: Anuj Borah <abo...@redhat.com>
Date: Mon, 19 Jul 2021 19:49:15 +0530
Subject: [PATCH] Tests: fix sss_cache to also reset cached timestamp

Issue: https://github.com/SSSD/sssd/issues/5596

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1902280
---
 .../multihost/alltests/test_sss_cache.py      | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 src/tests/multihost/alltests/test_sss_cache.py

diff --git a/src/tests/multihost/alltests/test_sss_cache.py b/src/tests/multihost/alltests/test_sss_cache.py
new file mode 100644
index 0000000000..5826adbc28
--- /dev/null
+++ b/src/tests/multihost/alltests/test_sss_cache.py
@@ -0,0 +1,60 @@
+""" Automation of sss_cache tests
+
+:subsystemteam: sst_idm_sssd
+:upstream: yes
+"""
+from __future__ import print_function
+import pytest
+import ldap
+from sssd.testlib.common.utils import sssdTools, LdapOperations
+from sssd.testlib.common.expect import pexpect_ssh
+from sssd.testlib.common.exceptions import SSHLoginException
+
+
+@pytest.mark.usefixtures('setup_sssd_krb', 'create_posix_usersgroups')
+@pytest.mark.sss_cache
+class TestKrbWithLogin(object):
+    @pytest.mark.tier1_2
+    def test_sss_cache_reset(self, multihost, backupsssdconf):
+        """
+            :title: fix sss_cache to also reset cached timestamp
+            :bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1902280
+            :IDM-SSSD-REQ: sss_cache improvements
+            :customerscenario: True
+            :id: c310f1b4-e89b-11eb-84ce-845cf3eff344
+            :steps:
+                1. Make a change to group entry in LDAP
+                2. Run 'ssh_cache -E' on clients
+                3. Check with 'getent group' on clients to see if correct\
+            :expectedresults:
+                1. Should succeed
+                2. Should succeed
+                3. Should succeed
+        """
+        tools = sssdTools(multihost.client[0])
+        domain_name = tools.get_domain_section_name()
+        client = sssdTools(multihost.client[0])
+        domain_params = {'ldap_schema': 'rfc2307bis',
+                         'ldap_group_member': 'uniquemember',
+                         'debug_level': '9'}
+        client.sssd_conf(f'domain/{domain_name}', domain_params)
+        multihost.client[0].service_sssd('restart')
+        get_ent = multihost.client[0].run_command("getent group "
+                                                  "ldapusers@example1")
+        assert "foo9@example1" in get_ent.stdout_text
+        user_dn = 'uid=foo9,ou=People,dc=example,dc=test'
+        group_dn = 'cn=ldapusers,ou=Groups,dc=example,dc=test'
+        ldap_uri = 'ldap://%s' % (multihost.master[0].sys_hostname)
+        ds_rootdn = 'cn=Directory Manager'
+        ds_rootpw = 'Secret123'
+        ldap_inst = LdapOperations(ldap_uri, ds_rootdn, ds_rootpw)
+        del_member = [(ldap.MOD_DELETE, 'uniqueMember',
+                       user_dn.encode('utf-8'))]
+        (ret, _) = ldap_inst.modify_ldap(group_dn, del_member)
+        assert ret == 'Success'
+        multihost.client[0].run_command("sss_cache -G")
+        multihost.client[0].run_command("sss_cache -E")
+        get_ent1 = multihost.client[0].run_command("getent group "
+                                                   "ldapusers@example1")
+        assert "foo9@example1" not in get_ent1.stdout_text
+        assert get_ent.stdout_text != get_ent1.stdout_text
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to