URL: https://github.com/SSSD/sssd/pull/5814
Author: aborah-sudo
 Title: #5814: Tests: sss_override does not take precedence over 
override_homedir di…
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/5814/head:pr5814
git checkout pr5814
From b876d812bf5477389fd3e0fb809db45d9d6ace73 Mon Sep 17 00:00:00 2001
From: Anuj Borah <abo...@redhat.com>
Date: Wed, 6 Oct 2021 17:59:51 +0530
Subject: [PATCH] Tests: sss_override does not take precedence over
 override_homedir directive

bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1919942
---
 src/tests/multihost/alltests/pytest.ini       |  1 +
 src/tests/multihost/alltests/readme.rst       |  1 +
 .../alltests/test_local_overrides.py          | 60 +++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 src/tests/multihost/alltests/test_local_overrides.py

diff --git a/src/tests/multihost/alltests/pytest.ini b/src/tests/multihost/alltests/pytest.ini
index 66519e8003..ac127c07f3 100644
--- a/src/tests/multihost/alltests/pytest.ini
+++ b/src/tests/multihost/alltests/pytest.ini
@@ -9,6 +9,7 @@ markers =
     krb5: Tests related to krb5
     kcm: Tests related to kcm
     ldapextraattrs: Tests related to Ldap Extra attributes
+    localoverrides: Tests related to Local Overrides
     multidomain: Tests related to SSSD Multiple Domains
     netgroup: Tests related to netgroup
     offline: Tests related to ldap offline suite
diff --git a/src/tests/multihost/alltests/readme.rst b/src/tests/multihost/alltests/readme.rst
index dd750b358a..13fa8cc56c 100644
--- a/src/tests/multihost/alltests/readme.rst
+++ b/src/tests/multihost/alltests/readme.rst
@@ -20,6 +20,7 @@ Following are the pytest markers used
 * krb5: Tests related to krb5
 * kcm: Tests related to kcm
 * ldapextraattrs: Tests related to Ldap Extra attributes
+* localoverrides: Tests related to Local Overrides
 * multidomain: Tests related to SSSD Multiple Domains
 * netgroup: Tests related to netgroup
 * offline: Tests related to ldap offline suite
diff --git a/src/tests/multihost/alltests/test_local_overrides.py b/src/tests/multihost/alltests/test_local_overrides.py
new file mode 100644
index 0000000000..0f3d9aa781
--- /dev/null
+++ b/src/tests/multihost/alltests/test_local_overrides.py
@@ -0,0 +1,60 @@
+""" Automation of ldap_extra_attr suite
+
+:requirement: localoverrides
+:casecomponent: sssd
+:subsystemteam: sst_idm_sssd
+:upstream: yes
+"""
+from __future__ import print_function
+import re
+import pytest
+from sssd.testlib.common.utils import sssdTools
+from constants import ds_instance_name
+import time
+
+
+@pytest.mark.usefixtures('setup_sssd', 'create_posix_usersgroups')
+@pytest.mark.localoverrides
+class TestLocalOverrides(object):
+    """
+    This is test case class for local overrides suite
+    """
+    @pytest.mark.tier1_2
+    def test_0007_bz1919942(self, multihost,
+                            backupsssdconf):
+        """
+        :title: ifp: sss_override does not take
+         precedence over override_homedir directive
+        :id: d2e98c70-26a0-11ec-bcf5-845cf3eff344
+        :customerscenario: true
+        :bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1919942
+        :steps:
+          1. Edit sssd.conf and set homedir, i.e.
+             `override_homedir = /home/%u1`
+          2. Restart sssd and check homedir
+          3. Use `sss_override` to set a
+             different home directory
+          4. Restart sssd and use getent command
+             to check home directory, which is still set to same.
+        :expectedresults:
+          1. Should succeed
+          2. Should succeed
+          3. Should succeed
+          4. Should succeed
+        """
+        tools = sssdTools(multihost.client[0])
+        domain_name = tools.get_domain_section_name()
+        client = sssdTools(multihost.client[0])
+        domain_params = {'override_homedir': '/home/%u1'}
+        client.sssd_conf(f'domain/{domain_name}', domain_params)
+        multihost.client[0].service_sssd('restart')
+        before = multihost.client[0].run_command("getent passwd "
+                                                 "foo5@example1")
+        assert before.returncode == 0
+        multihost.client[0].run_command("sss_override "
+                                        "user-add foo5@example1 -h "
+                                        "/home/foo56")
+        multihost.client[0].service_sssd('restart')
+        after = multihost.client[0].run_command("getent passwd "
+                                                "foo5@example1")
+        assert "User:/home/foo56" in after.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