Skip to content

Commit

Permalink
tests: test case audit and house keeping
Browse files Browse the repository at this point in the history
- standardized all system test case names in the new framework
- test_ldap.py: moved tests from test_offline.py, and test_rootdse.py because they have one topology which only ldap. renamed test_rootdse.py test cases names
- test_authentication.py: updated non descripted docstrings.
- test_identity.py: moved tests from test_autoprivategroup.py, because it perfroms an identity lookup and is one test case.
- test_autofs.py: removed ldap from autofs requirement, because test cases are now generic.
- test_proxy.py: updated test case name to reflect what is being tested -- test case should be updated
- test_memory_cache.py: renamed test cases to make it more readable
- test_sssctl.py merged with test_sssctl_analyze.py
- test_default_debug_level.py renamed to logging.py
  • Loading branch information
Dan Lavu committed Mar 25, 2024
1 parent 0d5e8f1 commit 664e986
Show file tree
Hide file tree
Showing 23 changed files with 1,024 additions and 784 deletions.
4 changes: 2 additions & 2 deletions src/tests/multihost/alltests/test_autoprivategroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'create_posix_usersgroups_autoprivategroups')
@pytest.mark.autoprivategroup
class TestAutoPrivateGroups(object):
@pytest.mark.converted('test_auto_private_groups.py', 'test_auto_private_groups__hybrid')
@pytest.mark.converted('test_identity.py', 'test_identity__lookup_when_private_groups_set_to_hybrid')
@pytest.mark.tier1
def test_0001_bz1695577(self, multihost, backupsssdconf):
"""
Expand All @@ -42,7 +42,7 @@ def test_0001_bz1695577(self, multihost, backupsssdconf):
output = cmd.stdout_text.split(':')
assert int(output[2]) == int(output[3])

@pytest.mark.converted('test_auto_private_groups.py', 'test_auto_private_groups__hybrid')
@pytest.mark.converted('test_identity.py', 'test_identity__lookup_when_private_groups_set_to_hybrid')
@pytest.mark.tier1
def test_0002_bz1695577(self, multihost, backupsssdconf):
"""
Expand Down
12 changes: 6 additions & 6 deletions src/tests/multihost/alltests/test_default_debug_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@pytest.mark.defaultdebuglevel
class TestDefaultDebugLevel(object):
""" Check sssd default debug level """
@pytest.mark.converted('test_default_debug_level.py', 'test_default_debug_level__check')
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_check')
@pytest.mark.tier1_4
def test_0001_check_default_debug_level(self, multihost, backupsssdconf):
"""
Expand Down Expand Up @@ -63,7 +63,7 @@ def test_0001_check_default_debug_level(self, multihost, backupsssdconf):
debug_str1 = pattern2.search(log_single_line)
assert debug_str1.group() == '(0x3f7c0)'

@pytest.mark.converted('test_default_debug_level.py', 'test_default_debug_level__check_with_login')
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_check_with_login')
@pytest.mark.tier1_4
def test_0002_check_default_level_with_auth(self, multihost,
backupsssdconf):
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_0002_check_default_level_with_auth(self, multihost,
assert ssh, f'{user} is not able to login'
assert alog_size.stdout_text == blog_size.stdout_text

@pytest.mark.converted('test_default_debug_level.py', 'test_default_debug_level__fatal_and_critical_failures')
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_fatal_and_critical_failures')
@pytest.mark.tier2
def test_0003_bz1893159(self, multihost, backupsssdconf):
"""
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_0003_bz1893159(self, multihost, backupsssdconf):
if not find1.search(log_str) and not find2.search(log_str):
assert False

@pytest.mark.converted('test_default_debug_level.py', 'test_default_debug_level__cannot_load_sssd_config')
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_cannot_load_sssd_config')
@pytest.mark.tier1_4
def test_0004_bz1893159(self, multihost, backupsssdconf):
"""
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_0004_bz1893159(self, multihost, backupsssdconf):
pattern = re.compile(r'SSSD couldn\'t load the configuration database')
assert pattern.search(log_str)

@pytest.mark.converted('test_default_debug_level.py', 'test_default_debug_level__nonexisting_ldap_server')
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_nonexisting_ldap_server')
@pytest.mark.tier1_4
def test_bz1893159(self, multihost, backupsssdconf):
"""
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_bz1893159(self, multihost, backupsssdconf):
#check what is logged at default debug_level(2)
assert find.search(log_str)

@pytest.mark.converted('test_default_debug_level.py', 'test_default_debug_level__sbus')
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_sbus')
@pytest.mark.tier1_4
def test_0005_bz1915319(self, multihost, backupsssdconf):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/tests/multihost/alltests/test_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestOffline(object):
"""
This is test case class for ldap offline suite
"""
@pytest.mark.converted('test_offline.py', 'test_offline__ldap_log_to_syslog')
@pytest.mark.converted('test_ldap.py', 'test_ldap__log_to_syslog')
@pytest.mark.tier1
def test_0001_bz1416150(self, multihost, backupsssdconf):
"""
Expand Down Expand Up @@ -59,7 +59,7 @@ def test_0001_bz1416150(self, multihost, backupsssdconf):
else:
pytest.fail("Failed to start sssd")

@pytest.mark.converted('test_offline.py', 'test_offline__ldap_network_timeout_parameters_shown_in_logs')
@pytest.mark.converted('test_ldap.py', 'test_ldap__network_timeout_parameters_shown_in_logs')
@pytest.mark.tier1_2
def test_0002_bz1928648(self, multihost, backupsssdconf):
"""
Expand Down
12 changes: 6 additions & 6 deletions src/tests/multihost/alltests/test_sssctl_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def analyze(multihost, req_arg, op_arg=None):
@pytest.mark.tier1_4
class TestSssctlAnalyze(object):
""" sssctl analyze test suite """
@pytest.mark.converted('test_sssctl_analyze.py', 'test_sssctl_analyze__list')
@pytest.mark.converted('test_sssctl.py', 'test_sssctl__analyze_list')
def test_analyze_list(self, multihost, backupsssdconf):
"""
:title: sssctl analyze list to show captured nss related
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_analyze_list(self, multihost, backupsssdconf):
_, stdout = analyze(multihost, act_op)
assert all(ptn in stdout for ptn in ['CID #1', 'getent'])

@pytest.mark.converted('test_sssctl_analyze.py', 'test_sssctl_analyze__non_default_log_location')
@pytest.mark.converted('test_sssctl.py', 'test_sssctl__analyze_non_default_log_location')
def test_analyze_diff_log_location(self, multihost, backupsssdconf):
"""
:title: sssctl analyze able to parse sssd logs from non-default
Expand Down Expand Up @@ -143,7 +143,7 @@ def test_analyze_diff_log_location(self, multihost, backupsssdconf):
_, stdout = analyze(multihost, act_op, log_dir)
assert 'sshd' in stdout

@pytest.mark.converted('test_sssctl_analyze.py', 'test_sssctl_analyze__pam_logs')
@pytest.mark.converted('test_sssctl.py', 'test_sssctl__analyze_pam_logs')
def test_analyze_pam_logs(self, multihost, backupsssdconf):
"""
:title: sssctl analyze to parse pam requests from logs
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_analyze_pam_logs(self, multihost, backupsssdconf):
for pam_auth in pam_cmds:
assert pam_auth in stdout

@pytest.mark.converted('test_sssctl_analyze.py', 'test_sssctl_analyze__tevent_id')
@pytest.mark.converted('test_sssctl.py', 'test_sssctl__analyze_tevent_id')
def test_analyze_tevent_id(self, multihost, backupsssdconf):
"""
:title: sssctl analyze to parse tevent chain IDs from logs
Expand Down Expand Up @@ -216,7 +216,7 @@ def test_analyze_tevent_id(self, multihost, backupsssdconf):
_, stdout = analyze(multihost, 'show 1 --pam')
assert all(ptn in stdout for ptn in ['RID#', user])

@pytest.mark.converted('test_sssctl_analyze.py', 'test_sssctl_analyze__parse_child_logs')
@pytest.mark.converted('test_sssctl.py', 'test_sssctl__analyze_parse_child_logs')
def test_analyze_parse_child_logs(self, multihost, backupsssdconf):
"""
:title: sssctl analyze to parse child logs from logs
Expand Down Expand Up @@ -264,7 +264,7 @@ def test_analyze_parse_child_logs(self, multihost, backupsssdconf):
_, stdout = analyze(multihost, 'show --pam --child 1')
assert re.findall(r"RID#[0-9]*] Received error code", stdout)

@pytest.mark.converted('test_sssctl_analyze.py', 'test_sssctl_analyze__root_privileges')
@pytest.mark.converted('test_sssctl.py', 'test_sssctl__analyze_root_privileges')
@staticmethod
def test_non_root_privileged(multihost, localusers):
"""
Expand Down
13 changes: 9 additions & 4 deletions src/tests/system/tests/test_authentication.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
SSSD Sanity Test Cases
SSSD Authentication Test Cases
:requirement: offline
"""
Expand All @@ -20,9 +20,11 @@
lambda client, sssd_service_user: ((sssd_service_user == "root") or client.features["non-privileged"]),
"SSSD was built without support for running under non-root",
)
def test_authentication__login(client: Client, provider: GenericProvider, method: str, sssd_service_user: str):
def test_authentication__using_a_good_then_bad_password(
client: Client, provider: GenericProvider, method: str, sssd_service_user: str
):
"""
:title: ssh/su login
:title: SSH and su authentication
:setup:
1. Add user to SSSD
2. Set password for user
Expand Down Expand Up @@ -51,7 +53,9 @@ def test_authentication__login(client: Client, provider: GenericProvider, method
lambda client, sssd_service_user: ((sssd_service_user == "root") or client.features["non-privileged"]),
"SSSD was built without support for running under non-root",
)
def test_authentication__offline_login(client: Client, provider: GenericProvider, method: str, sssd_service_user: str):
def test_authentication__using_a_good_then_bad_password_when_offline(
client: Client, provider: GenericProvider, method: str, sssd_service_user: str
):
"""
:title: Offline ssh/su login
:setup:
Expand All @@ -74,6 +78,7 @@ def test_authentication__offline_login(client: Client, provider: GenericProvider
5. Offline authentication is successful
6. Offline authentication is not successful
:customerscenario: False
:TODO: Make this a generic test.
"""
user = "user1"
correct = "Secret123"
Expand Down
48 changes: 0 additions & 48 deletions src/tests/system/tests/test_auto_private_groups.py

This file was deleted.

12 changes: 6 additions & 6 deletions src/tests/system/tests/test_autofs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Autofs tests.
Automount Test Cases
:requirement: Ldap Provider - automount
:requirement: autofs
"""

from __future__ import annotations
Expand All @@ -22,7 +22,7 @@
lambda client, sssd_service_user: ((sssd_service_user == "root") or client.features["non-privileged"]),
"SSSD was built without support for running under non-root",
)
def test_autofs__cache_first(
def test_autofs__cache_first_set_to_true(
client: Client, nfs: NFS, provider: GenericProvider, cache_first: bool, sssd_service_user: str
):
"""
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_autofs__cache_first(

@pytest.mark.importance("medium")
@pytest.mark.topology(KnownTopologyGroup.AnyProvider)
def test_autofs__propagate_offline__single_domain(client: Client, provider: GenericProvider):
def test_autofs__propagate_offline_status_for_a_single_domain(client: Client, provider: GenericProvider):
"""
:title: Autofs propagates offline status if a domain is offline
:setup:
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_autofs__propagate_offline__single_domain(client: Client, provider: Gene

@pytest.mark.importance("critical")
@pytest.mark.topology(KnownTopologyGroup.AnyProvider)
def test_autofs__propagate_offline__multi_domain(client: Client):
def test_autofs__propagate_offline_status_for_multiple_domains(client: Client):
"""
:title: Autofs propagates offline status if a domain is offline in multi domain environment
:setup:
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_autofs__propagate_offline__multi_domain(client: Client):

@pytest.mark.importance("critical")
@pytest.mark.topology(KnownTopologyGroup.AnyProvider)
def test_autofs__offline_domains(client: Client, nfs: NFS, provider: GenericProvider):
def test_autofs__works_with_some_offline_domains(client: Client, nfs: NFS, provider: GenericProvider):
"""
:title: Autofs works if some domain is offline in multi domain environment
:setup:
Expand Down
Loading

0 comments on commit 664e986

Please sign in to comment.