Skip to content

Commit

Permalink
Merge pull request #1242 from paravoid/tests-more-fixes
Browse files Browse the repository at this point in the history
tests: more compatibility fixes
  • Loading branch information
giuseppe authored Jul 13, 2023
2 parents 56d9d9a + 58bb52c commit 017bd29
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/test_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def test_uid_tty():
if is_rootless():
return 77

if os.isatty(1) == False:
return 77

conf = base_config()
conf['process']['args'] = ['/init', 'pause']
conf['process']['terminal'] = True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_oci_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def is_seccomp_enabled():

def get_crun_commit():
try:
output = subprocess.check_output(["./crun", "--version"]).decode()
output = subprocess.check_output([get_crun_path(), "--version"]).decode()
commit_match = re.search(r"commit: ([\w]+)", output)

if commit_match:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def test_resources_cpu_weight_systemd():

conf['linux']['resources'] = {}
conf['linux']['resources']['unified'] = {

"cpu.weight": "1234"
}
cid = None
Expand All @@ -251,6 +252,10 @@ def test_resources_cpu_weight_systemd():
scope = json.loads(state)['systemd-scope']

out = subprocess.check_output(['systemctl', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip()
# try once more against the user manager, as if one exists, crun will prefer it; see bug #1197
if out != "1234":
out = subprocess.check_output(['systemctl', '--user', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip()

if out != "1234":
sys.stderr.write("found wrong CPUWeight for the systemd scope\n")
return 1
Expand All @@ -265,6 +270,10 @@ def test_resources_cpu_weight_systemd():
return -1

out = subprocess.check_output(['systemctl', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip()
# as above
if out != expected_weight:
out = subprocess.check_output(['systemctl', '--user', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip()

if out != expected_weight:
sys.stderr.write("found wrong CPUWeight for the systemd scope\n")
return 1
Expand Down

0 comments on commit 017bd29

Please sign in to comment.