Skip to content

Commit

Permalink
Tests: Fix test_008_wildcardsearch for RHEL10
Browse files Browse the repository at this point in the history
tshark -r /tmp/automount.pcap -R ldap.filter  ---> Provides empty result for RHEL10 making this test absolute.
  • Loading branch information
aborah-sudo committed Feb 5, 2025
1 parent 36b1d97 commit e7af04e
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions src/tests/multihost/alltests/test_automount.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,8 @@ def test_008_wildcardsearch(self, multihost, indirect_nismaps,
:expectedresults:
1. Verify sssd doesn't use (cn=*)(objectclass=nisObject)
"""
auto_pcapfile = '/tmp/automount.pcap'
ldap_host = multihost.master[0].sys_hostname
tcpdump_cmd = 'tcpdump -s0 host %s -w %s' % (ldap_host, auto_pcapfile)
multihost.client[0].run_command(tcpdump_cmd, bg=True)
# pid_cmd = 'pidof tcpdump'
# pid = multihost.client[0].run_command(pid_cmd, raiseonerr=False)
client = sssdTools(multihost.client[0])
domain_name = client.get_domain_section_name()
for service in ['sssd', 'autofs']:
restart = 'systemctl restart %s' % service
cmd = multihost.client[0].run_command(restart, raiseonerr=False)
Expand All @@ -447,27 +443,14 @@ def test_008_wildcardsearch(self, multihost, indirect_nismaps,
if cmd.returncode != 0:
count += 1
assert count == 0
kill_cmd = 'pkill tcpdump'
multihost.client[0].run_command(kill_cmd)
# get the pcap file in text format
conv_text = 'tshark -r %s -R ldap.filter'\
' -V -2 > /tmp/automount.txt' % (auto_pcapfile)
multihost.client[0].run_command(conv_text, raiseonerr=False)
# get the file
multihost.client[0].transport.get_file('/tmp/automount.txt',
'/tmp/automount.txt')
with open('/tmp/automount.txt', 'r') as outfile:
tcpdump_ascii = outfile.read()
tcpdump_ascii = multihost.client[0].get_file_contents(f'/var/log/sssd/sssd_{domain_name}.log').decode('utf-8')
for i in range(1, 10):
key = 'foo%d' % i
ldap_filter = r'\(\&\(cn=%s\)\(objectclass=nisObject\)\)' % key
log_1 = re.compile(r'%s' % (ldap_filter))
assert log_1.search(tcpdump_ascii)

# delete the pcap file
del_pcap = 'rm -f %s' % auto_pcapfile
multihost.client[0].run_command(del_pcap)

@pytest.mark.parametrize('add_nisobject', ['/export'], indirect=True)
@pytest.mark.tier2
def test_009_maps_after_coming_online(self, multihost, add_nisobject):
Expand Down

0 comments on commit e7af04e

Please sign in to comment.