Skip to content

Commit

Permalink
Tests: Rename test_misc.py to test_all_misc.py
Browse files Browse the repository at this point in the history
Individual test suite `test_misc.py` is green but need to troubleshoot why getting failures once we run with alltests.
  • Loading branch information
aborah-sudo committed Feb 13, 2025
1 parent 5e16c95 commit a393ce4
Showing 1 changed file with 51 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,57 @@ class TestMisc(object):
"""
This is for misc bugs automation
"""
@staticmethod
@pytest.mark.tier1_2
def test_0017_filesldap(multihost, backupsssdconf, setup_sssd_krb):
"""
:title: sssd-be tends to run out of system resources,
hitting the maximum number of open files
:id: ad4a4a32-05d7-11ee-9caa-845cf3eff344
:bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2195919
:setup:
1. Replace /usr/libexec/sssd/krb5_child with a shell script like
#!/bin/bash
sleep 10
:steps:
1. Login with ldap user and count no of file descriptors before modifying krb5_child
2. Trigger authentication requests 'sssctl user-checks -a auth
3. Count no of file descriptors after modifying krb5_child
:expectedresults:
1. Login should success
2. Authentication requests will fail
3. No of file descriptors should be same as before and after modifying krb5_child
"""
client = multihost.client[0]
tools = sssdTools(multihost.client[0])
tools.clear_sssd_cache()
user = f'foo1@{ds_instance_name}'
check_login_client(multihost, user, "Secret123")
time.sleep(3)
client.run_command("cp -af /usr/libexec/sssd/krb5_child /usr/libexec/sssd/krb5_child_bkp")
new_child = textwrap.dedent("""#!/bin/bash\nsleep 10 \n""")
client.put_file_contents('/usr/libexec/sssd/krb5_child', new_child)
client.run_command(f"echo 'Secret123'|sssctl user-checks -a auth foo1@{ds_instance_name}")
time.sleep(3)
client.run_command('ls -al /proc/$(pidof sssd_be)/fd > /tmp/before_count')
time.sleep(2)
n_log_bfr = count_pattern_logs(multihost, "/tmp/before_count", "pipe:")
for i in range(10):
client.run_command(f"echo 'Secret123'|sssctl user-checks -a auth foo{i}@{ds_instance_name}")
time.sleep(3)
client.run_command(f'ls -al /proc/$(pidof sssd_be)/fd > /tmp/after_count{i}')
time.sleep(2)
n_log_afr = []
for i in range(10):
n_log_afr.append(count_pattern_logs(multihost, f"/tmp/after_count{i}", "pipe:"))
client.run_command("cp -a /usr/libexec/sssd/krb5_child_bkp /usr/libexec/sssd/krb5_child")
for f_file in ["/tmp/before_count", "/usr/libexec/sssd/krb5_child_bkp"]:
client_remove_file(multihost, f_file)
for i in range(10):
client_remove_file(multihost, f"/tmp/after_count{i}")
for n_n in n_log_afr:
assert abs(n_log_bfr - n_n) <= 2

@pytest.mark.tier1
def test_0001_ldapcachepurgetimeout(self,
multihost, backupsssdconf):
Expand Down Expand Up @@ -560,54 +611,3 @@ def test_bz822236(multihost, backupsssdconf):
ldap_inst.del_dn(f"ou=Netgroup,{ds_suffix}")
assert all(find_logs_results), "Searched string not found in the logs"
assert all(time_diff), "Test failed as the cache response time is higher."

@staticmethod
@pytest.mark.tier1_2
def test_0017_filesldap(multihost, backupsssdconf, setup_sssd_krb):
"""
:title: sssd-be tends to run out of system resources,
hitting the maximum number of open files
:id: ad4a4a32-05d7-11ee-9caa-845cf3eff344
:bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2195919
:setup:
1. Replace /usr/libexec/sssd/krb5_child with a shell script like
#!/bin/bash
sleep 10
:steps:
1. Login with ldap user and count no of file descriptors before modifying krb5_child
2. Trigger authentication requests 'sssctl user-checks -a auth
3. Count no of file descriptors after modifying krb5_child
:expectedresults:
1. Login should success
2. Authentication requests will fail
3. No of file descriptors should be same as before and after modifying krb5_child
"""
client = multihost.client[0]
tools = sssdTools(multihost.client[0])
tools.clear_sssd_cache()
user = f'foo1@{ds_instance_name}'
check_login_client(multihost, user, "Secret123")
time.sleep(3)
client.run_command("cp -af /usr/libexec/sssd/krb5_child /usr/libexec/sssd/krb5_child_bkp")
new_child = textwrap.dedent("""#!/bin/bash\nsleep 10 \n""")
client.put_file_contents('/usr/libexec/sssd/krb5_child', new_child)
client.run_command(f"echo 'Secret123'|sssctl user-checks -a auth foo1@{ds_instance_name}")
time.sleep(3)
client.run_command('ls -al /proc/$(pidof sssd_be)/fd > /tmp/before_count')
time.sleep(2)
n_log_bfr = count_pattern_logs(multihost, "/tmp/before_count", "pipe:")
for i in range(10):
client.run_command(f"echo 'Secret123'|sssctl user-checks -a auth foo{i}@{ds_instance_name}")
time.sleep(3)
client.run_command(f'ls -al /proc/$(pidof sssd_be)/fd > /tmp/after_count{i}')
time.sleep(2)
n_log_afr = []
for i in range(10):
n_log_afr.append(count_pattern_logs(multihost, f"/tmp/after_count{i}", "pipe:"))
client.run_command("cp -a /usr/libexec/sssd/krb5_child_bkp /usr/libexec/sssd/krb5_child")
for f_file in ["/tmp/before_count", "/usr/libexec/sssd/krb5_child_bkp"]:
client_remove_file(multihost, f_file)
for i in range(10):
client_remove_file(multihost, f"/tmp/after_count{i}")
for n_n in n_log_afr:
assert abs(n_log_bfr - n_n) <= 2

0 comments on commit a393ce4

Please sign in to comment.