From cb5c094ba260d903fc02cfbe156cc9ef3c16c765 Mon Sep 17 00:00:00 2001 From: Anuja More Date: Jul 07 2020 12:12:14 +0000 Subject: ipatests : Test to verify override_gid works with subdomain. When override_gid is set in sssd.conf in IPA domain section Then it should also work for subdomain. Related: https://pagure.io/SSSD/sssd/issue/4061 Signed-off-by: Anuja More Reviewed-By: Kaleemullah Siddiqui Reviewed-By: Armando Neto Reviewed-By: Florence Blanc-Renaud Reviewed-By: Mohammad Rizwan Reviewed-By: Alexander Bokovoy --- diff --git a/ipatests/test_integration/test_sssd.py b/ipatests/test_integration/test_sssd.py index ad70c1d..1e3ee77 100644 --- a/ipatests/test_integration/test_sssd.py +++ b/ipatests/test_integration/test_sssd.py @@ -481,6 +481,34 @@ class TestSSSDWithAdTrust(IntegrationTest): for text in verify_in_stdout: assert text in second_res.stdout_text + @contextmanager + def override_gid_setup(self, gid): + sssd_conf_backup = tasks.FileBackup(self.master, paths.SSSD_CONF) + try: + with tasks.remote_sssd_config(self.master) as sssd_conf: + sssd_conf.edit_domain(self.master.domain, + 'override_gid', gid) + tasks.clear_sssd_cache(self.master) + yield + finally: + sssd_conf_backup.restore() + tasks.clear_sssd_cache(self.master) + + def test_override_gid_subdomain(self): + """Test that override_gid is working for subdomain + + This is a regression test for sssd bug: + https://pagure.io/SSSD/sssd/issue/4061 + """ + tasks.clear_sssd_cache(self.master) + user = self.users['child_ad']['name'] + gid = 10264 + # verify the user can be retrieved initially + self.master.run_command(['id', user]) + with self.override_gid_setup(gid): + test_gid = self.master.run_command(['id', user]) + assert 'gid={id}'.format(id=gid) in test_gid.stdout_text + class TestNestedMembers(IntegrationTest): num_clients = 1