File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,15 @@ def test_exec_run_success(self):
353
353
assert exec_output [0 ] == 0
354
354
assert exec_output [1 ] == b"hello\n "
355
355
356
+ def test_exec_run_error_code_from_exec (self ):
357
+ client = docker .from_env (version = TEST_API_VERSION )
358
+ container = client .containers .run (
359
+ "alpine" , "sh -c 'sleep 20'" , detach = True
360
+ )
361
+ self .tmp_containers .append (container .id )
362
+ exec_output = container .exec_run ("sh -c 'exit 42'" )
363
+ assert exec_output [0 ] == 42
364
+
356
365
def test_exec_run_failed (self ):
357
366
client = docker .from_env (version = TEST_API_VERSION )
358
367
container = client .containers .run (
@@ -363,7 +372,7 @@ def test_exec_run_failed(self):
363
372
# older versions of docker return `126` in the case that an exec cannot
364
373
# be started due to a missing executable. We're fixing this for the
365
374
# future, so accept both for now.
366
- assert exec_output [0 ] == 127 or exec_output == 126
375
+ assert exec_output [0 ] == 127 or exec_output [ 0 ] == 126
367
376
368
377
def test_kill (self ):
369
378
client = docker .from_env (version = TEST_API_VERSION )
You can’t perform that action at this time.
0 commit comments