@@ -991,7 +991,7 @@ def test_pause_unpause(self):
991
991
self .assertEqual (state ['Paused' ], False )
992
992
993
993
994
- class GetContainerStatsTest (BaseTestCase ):
994
+ class GetContainerStatsTest (api_test . BaseTestCase ):
995
995
@requires_api_version ('1.19' )
996
996
def test_get_container_stats_no_stream (self ):
997
997
container = self .client .create_container (
@@ -1002,7 +1002,21 @@ def test_get_container_stats_no_stream(self):
1002
1002
response = self .client .stats (container , stream = 0 )
1003
1003
self .client .kill (container )
1004
1004
1005
- self .assertEquals (type (response ), dict )
1005
+ self .assertEqual (type (response ), dict )
1006
1006
for key in ['read' , 'network' , 'precpu_stats' , 'cpu_stats' ,
1007
1007
'memory_stats' , 'blkio_stats' ]:
1008
1008
self .assertIn (key , response )
1009
+
1010
+ @requires_api_version ('1.17' )
1011
+ def test_get_container_stats_stream (self ):
1012
+ container = self .client .create_container (
1013
+ BUSYBOX , ['sleep' , '60' ],
1014
+ )
1015
+ self .tmp_containers .append (container )
1016
+ self .client .start (container )
1017
+ stream = self .client .stats (container )
1018
+ for chunk in stream :
1019
+ self .assertEqual (type (chunk ), dict )
1020
+ for key in ['read' , 'network' , 'precpu_stats' , 'cpu_stats' ,
1021
+ 'memory_stats' , 'blkio_stats' ]:
1022
+ self .assertIn (key , chunk )
0 commit comments