Skip to content

Commit 96ef4d3

Browse files
committed
tests/exec: expect 127 exit code for missing executable
Docker Engine has always returned `126` when starting an exec fails due to a missing binary, but this was due to a bug in the daemon causing the correct exit code to be overwritten in some cases – see: moby/moby#45795 Change tests to expect correct exit code (`127`). Signed-off-by: Laura Brehm <[email protected]>
1 parent a365202 commit 96ef4d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/integration/models_containers_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,11 @@ def test_exec_run_failed(self):
359359
"alpine", "sh -c 'sleep 60'", detach=True
360360
)
361361
self.tmp_containers.append(container.id)
362-
exec_output = container.exec_run("docker ps")
363-
assert exec_output[0] == 126
362+
exec_output = container.exec_run("non-existent")
363+
# older versions of docker return `126` in the case that an exec cannot
364+
# be started due to a missing executable. We're fixing this for the
365+
# future, so accept both for now.
366+
assert exec_output[0] == 127 or exec_output == 126
364367

365368
def test_kill(self):
366369
client = docker.from_env(version=TEST_API_VERSION)

0 commit comments

Comments
 (0)