Kaydet (Commit) 5cfd2da4 authored tarafından Antonis Kalipetis's avatar Antonis Kalipetis

Add test for streaming stats

Also, fix typo in non-streaming stats.
Signed-off-by: 's avatarAntonis Kalipetis <akalipetis@gmail.com>
üst 192391a5
......@@ -991,7 +991,7 @@ class PauseTest(api_test.BaseTestCase):
self.assertEqual(state['Paused'], False)
class GetContainerStatsTest(BaseTestCase):
class GetContainerStatsTest(api_test.BaseTestCase):
@requires_api_version('1.19')
def test_get_container_stats_no_stream(self):
container = self.client.create_container(
......@@ -1002,7 +1002,21 @@ class GetContainerStatsTest(BaseTestCase):
response = self.client.stats(container, stream=0)
self.client.kill(container)
self.assertEquals(type(response), dict)
self.assertEqual(type(response), dict)
for key in ['read', 'network', 'precpu_stats', 'cpu_stats',
'memory_stats', 'blkio_stats']:
self.assertIn(key, response)
@requires_api_version('1.17')
def test_get_container_stats_stream(self):
container = self.client.create_container(
BUSYBOX, ['sleep', '60'],
)
self.tmp_containers.append(container)
self.client.start(container)
stream = self.client.stats(container)
for chunk in stream:
self.assertEqual(type(chunk), dict)
for key in ['read', 'network', 'precpu_stats', 'cpu_stats',
'memory_stats', 'blkio_stats']:
self.assertIn(key, chunk)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment