@@ -1092,20 +1092,28 @@ def test_run_container_reading_socket(self):
1092
1092
command = "printf '{0}'" .format (line )
1093
1093
container = self .client .create_container (BUSYBOX , command ,
1094
1094
detach = True , tty = False )
1095
- ident = container ['Id' ]
1096
- self .tmp_containers .append (ident )
1095
+ self .tmp_containers .append (container )
1097
1096
1098
1097
opts = {"stdout" : 1 , "stream" : 1 , "logs" : 1 }
1099
- pty_stdout = self .client .attach_socket (ident , opts )
1098
+ pty_stdout = self .client .attach_socket (container , opts )
1100
1099
self .addCleanup (pty_stdout .close )
1101
1100
1102
- self .client .start (ident )
1101
+ self .client .start (container )
1103
1102
1104
1103
next_size = next_frame_size (pty_stdout )
1105
1104
self .assertEqual (next_size , len (line ))
1106
1105
data = read_exactly (pty_stdout , next_size )
1107
1106
self .assertEqual (data .decode ('utf-8' ), line )
1108
1107
1108
+ def test_attach_no_stream (self ):
1109
+ container = self .client .create_container (
1110
+ BUSYBOX , 'echo hello'
1111
+ )
1112
+ self .tmp_containers .append (container )
1113
+ self .client .start (container )
1114
+ output = self .client .attach (container , stream = False , logs = True )
1115
+ assert output == 'hello\n ' .encode (encoding = 'ascii' )
1116
+
1109
1117
1110
1118
class PauseTest (BaseAPIIntegrationTest ):
1111
1119
def test_pause_unpause (self ):
0 commit comments