Skip to content

Commit

Permalink
tests, exec: fix race using run -d instead of run
Browse files Browse the repository at this point in the history
detach the container instead of keeping the "crun run" process alive.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Jul 7, 2020
1 parent a7ae79a commit 7aa16ff
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions tests/test_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@ def test_exec():
add_all_namespaces(conf)
cid = None
try:
proc, cid = run_and_get_output(conf, command='run', use_popen=True)
for i in range(50):
try:
s = run_crun_command(["state", cid])
break
except Exception as e:
time.sleep(0.1)

_, cid = run_and_get_output(conf, command='run', detach=True)
out = run_crun_command(["exec", cid, "/init", "echo", "foo"])
if "foo" not in out:
return -1
Expand All @@ -51,14 +44,7 @@ def test_exec_not_exists_helper(detach):
add_all_namespaces(conf)
cid = None
try:
proc, cid = run_and_get_output(conf, command='run', use_popen=True)
for i in range(50):
try:
s = run_crun_command(["state", cid])
break
except Exception as e:
time.sleep(0.1)

_, cid = run_and_get_output(conf, command='run', detach=True)
try:
if detach:
out = run_crun_command(["exec", "-d", cid, "/not.here"])
Expand Down

0 comments on commit 7aa16ff

Please sign in to comment.