Beispiel #1
0
 def test_init_container_stats_filesystem(self):
     container_stats = ContainerStats({'filesystem': [
         {
             'device': 123
         },
     ]})
     self.assertEqual(len(container_stats.filesystem), 1)
     self.assertEqual(container_stats.filesystem[0].__class__, FsStats)
     self.assertEqual(container_stats.filesystem[0].device, 123)
Beispiel #2
0
 def test_init_container_stats_custom_metrics(self):
     metric_list = [{'metric1': 123}, {'metric2': 456}]
     container_stats = ContainerStats(
         {'custom_metrics': {
             'test1': metric_list
         }})
     self.assertEqual(len(container_stats.custom_metrics['test1']), 2)
     self.assertEqual(container_stats.custom_metrics['test1'][0].__class__,
                      MetricVal)
     self.assertEqual(container_stats.custom_metrics['test1'][1].__class__,
                      MetricVal)
Beispiel #3
0
 def test_init_container_stats_task_stats(self):
     container_stats = ContainerStats({'task_stats': {'nr_sleeping': 123}})
     self.assertEqual(container_stats.task_stats.__class__, LoadStats)
     self.assertEqual(container_stats.task_stats.nr_sleeping, 123)
Beispiel #4
0
 def test_init_container_stats_memory(self):
     container_stats = ContainerStats({'memory': {'usage': 123}})
     self.assertEqual(container_stats.memory.__class__, MemoryStats)
     self.assertEqual(container_stats.memory.usage, 123)
Beispiel #5
0
 def test_init_container_stats_diskio(self):
     container_stats = ContainerStats({'diskio': {'io_service_bytes': 123}})
     self.assertEqual(container_stats.diskio.__class__, DiskIoStats)
     self.assertEqual(container_stats.diskio.io_service_bytes, 123)
Beispiel #6
0
 def test_init_container_stats_cpu(self):
     container_stats = ContainerStats({'cpu': {'load_average': 123}})
     self.assertEqual(container_stats.cpu.__class__, CpuStats)
     self.assertEqual(container_stats.cpu.load_average, 123)
Beispiel #7
0
 def test_init_container_stats_timestamp(self):
     container_stats = ContainerStats(
         {'timestamp': '2016-08-24T21:19:24.623769018Z'})
     time = datetime(2016, 8, 24, 21, 19, 24, 623769)
     self.assertEqual(container_stats.timestamp, time)