Skip to content

Commit

Permalink
Test: Minor update
Browse files Browse the repository at this point in the history
Signed-off-by: Madhuri Upadhye <[email protected]>
  • Loading branch information
madhuriupadhye committed Dec 8, 2023
1 parent 2de907b commit c4f2122
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/tests/multihost/ipa/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ def environment_setup(session_multihost, request):
" -y shadow-utils*")
client.run_command("yum install -y gcc")
client.run_command("yum install -y podman")
with pytest.raises(subprocess.CalledProcessError):
client.run_command("grep subid /etc/nsswitch.conf")
# with pytest.raises(subprocess.CalledProcessError):
# client.run_command("grep subid /etc/nsswitch.conf")

Check notice

Code scanning / CodeQL

Commented-out code Note test

This comment appears to contain commented-out code.
file_location = "/data/list_subid_ranges.c"
client.transport.put_file(os.path.dirname(os.path.abspath(__file__))
+ file_location,
Expand Down
14 changes: 9 additions & 5 deletions src/tests/multihost/ipa/test_subid_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def ipa_subid_find(multihost):
@pytest.mark.usefixtures('environment_setup',
'subid_generate',
'bkp_cnfig_for_subid_files')
@pytest.mark.tier1
@pytest.mark.tier4
class TestSubid(object):
"""
This is for ipa bugs automation
Expand All @@ -60,19 +60,22 @@ def test_podmanmap_feature(multihost):
2. Should succeed
"""
ipa_subid_find(multihost)
multihost.client[0].run_command(f'su - admin -c "rm -rf /home/admin/.local/share/containers"', raiseonerr=False)
multihost.client[0].run_command(f"podman system migrate", raiseonerr=False)
multihost.client[0].run_command(f"sysctl user.max_user_namespaces=15000", raiseonerr=False)
map1 = "/proc/self/uid_map"
cmd = multihost.client[0].run_command(
f'su - {USER} -c "podman unshare cat {map1}"', raiseonerr=False)
actual_result = cmd.stdout_text.splitlines()

# assert str(uid_start) == actual_result[1].split()[1]
# assert str(uid_range) == actual_result[1].split()[2]
assert str(uid_start) == actual_result[1].split()[1]
assert str(uid_range) == actual_result[1].split()[2]
map2 = "/proc/self/gid_map"
cmd = multihost.client[0].run_command(
f'su - {USER} -c "podman unshare cat {map2}"', raiseonerr=False)
actual_result = cmd.stdout_text.splitlines()
# assert str(gid_start) == actual_result[1].split()[1]
# assert str(gid_range) == actual_result[1].split()[2]
assert str(gid_start) == actual_result[1].split()[1]
assert str(gid_range) == actual_result[1].split()[2]

@staticmethod
def test_subid_feature(multihost):
Expand Down Expand Up @@ -156,3 +159,4 @@ def test_list_subid_ranges(multihost):
assert str(USER) == cmd.stdout_text.split()[1]
assert str(gid_start) == cmd.stdout_text.split()[2]
assert str(gid_range) == cmd.stdout_text.split()[3]

0 comments on commit c4f2122

Please sign in to comment.