mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from .helper import DashboardTestCase, authenticate
|
|
|
|
|
|
class OsdTest(DashboardTestCase):
|
|
|
|
def assert_in_and_not_none(self, data, properties):
|
|
for prop in properties:
|
|
self.assertIn(prop, data)
|
|
self.assertIsNotNone(data[prop])
|
|
|
|
@authenticate
|
|
def test_list(self):
|
|
data = self._get('/api/osd')
|
|
self.assertStatus(200)
|
|
|
|
self.assertGreaterEqual(len(data), 1)
|
|
data = data[0]
|
|
self.assert_in_and_not_none(data, ['host', 'tree', 'state', 'stats', 'stats_history'])
|
|
self.assert_in_and_not_none(data['host'], ['name'])
|
|
self.assert_in_and_not_none(data['tree'], ['id'])
|
|
self.assert_in_and_not_none(data['stats'], ['numpg', 'stat_bytes_used', 'stat_bytes',
|
|
'op_r', 'op_w'])
|
|
self.assert_in_and_not_none(data['stats_history'], ['op_out_bytes', 'op_in_bytes'])
|
|
|
|
@authenticate
|
|
def test_details(self):
|
|
data = self._get('/api/osd/0')
|
|
self.assertStatus(200)
|
|
self.assert_in_and_not_none(data, ['osd_metadata', 'histogram'])
|
|
self.assert_in_and_not_none(data['histogram'], ['osd'])
|
|
self.assert_in_and_not_none(data['histogram']['osd'], ['op_w_latency_in_bytes_histogram',
|
|
'op_r_latency_out_bytes_histogram'])
|