Skip to content

Commit fd821f2

Browse files
committed
Test dashboard endpoint
1 parent 22d750b commit fd821f2

File tree

4 files changed

+217
-9
lines changed

4 files changed

+217
-9
lines changed

ecsclient/common/monitoring/dashboard.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
# Standard lib imports
21
import logging
32

4-
# Third party imports
5-
# None
6-
7-
# Project level imports
8-
# None
9-
103

114
log = logging.getLogger(__name__)
125

@@ -48,7 +41,7 @@ def get_local_zone_replication_groups(self):
4841
4942
Too large to output here
5043
"""
51-
log.info("Getting vpools in local VDC")
44+
log.info("Getting local VDC replication groups details")
5245
return self.conn.get(url='dashboard/zones/localzone/replicationgroups')
5346

5447
def get_local_zone_rglinks_failed(self):

ecsclient/schemas.py

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,3 +857,198 @@
857857
"totalProvisioned_gb"
858858
]
859859
}
860+
861+
DASHBOARD_REPLICATION_GROUP_TRAFFIC = {
862+
"type": "object",
863+
"properties": {
864+
"Bandwidth": {"type": "string"},
865+
"t": {"type": "string"},
866+
},
867+
"required": [
868+
"Bandwidth",
869+
"t"
870+
]
871+
}
872+
873+
DASHBOARD_REPLICATION_GROUP_TRAFFIC_SUMMARY = {
874+
"type": "object",
875+
"properties": {
876+
"Max": {
877+
"type": "array",
878+
"minItems": 0,
879+
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
880+
},
881+
"Min": {
882+
"type": "array",
883+
"minItems": 0,
884+
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
885+
},
886+
"Avg": {"type": "string"},
887+
},
888+
"required": [
889+
"Max",
890+
"Min",
891+
"Avg"
892+
]
893+
}
894+
895+
DASHBOARD_REPLICATION_GROUP = {
896+
"type": "object",
897+
"properties": {
898+
"chunksRepoPendingReplicationTotalSize": {"type": "string"},
899+
"chunksJournalPendingReplicationTotalSize": {"type": "string"},
900+
"chunksPendingXorTotalSize": {"type": "string"},
901+
"name": {"type": "string"},
902+
"id": {"type": "string"},
903+
"numZones": {"type": "string"},
904+
"apiChange": {"type": "string"},
905+
"replicationIngressTrafficSummary": DASHBOARD_REPLICATION_GROUP_TRAFFIC_SUMMARY,
906+
"replicationEgressTrafficSummary": DASHBOARD_REPLICATION_GROUP_TRAFFIC_SUMMARY,
907+
"replicationIngressTraffic": {
908+
"type": "array",
909+
"minItems": 0,
910+
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
911+
},
912+
"replicationEgressTraffic": {
913+
"type": "array",
914+
"minItems": 0,
915+
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
916+
},
917+
"_links": {
918+
"type": "object",
919+
"properties": {
920+
"self": {
921+
"type": "object",
922+
"properties": {
923+
"href": {"type": "string"},
924+
},
925+
"required": [
926+
"href",
927+
]
928+
},
929+
"rglinks": {
930+
"type": "object",
931+
"properties": {
932+
"href": {"type": "string"},
933+
},
934+
"required": [
935+
"href",
936+
]
937+
},
938+
"datatables": {
939+
"type": "object",
940+
"properties": {
941+
"href": {"type": "string"},
942+
},
943+
"required": [
944+
"href",
945+
]
946+
}
947+
},
948+
"required": [
949+
"self",
950+
"rglinks",
951+
"datatables",
952+
]
953+
},
954+
},
955+
"required": [
956+
"chunksRepoPendingReplicationTotalSize",
957+
"chunksJournalPendingReplicationTotalSize",
958+
"chunksPendingXorTotalSize",
959+
"name",
960+
"id",
961+
"numZones",
962+
"apiChange",
963+
"replicationIngressTrafficSummary",
964+
"replicationEgressTrafficSummary",
965+
"replicationIngressTraffic",
966+
"replicationEgressTraffic",
967+
"_links"
968+
]
969+
}
970+
971+
DASHBOARD_REPLICATION_GROUPS = {
972+
"type": "object",
973+
"properties": {
974+
"title": {"type": "string"},
975+
"_links": {
976+
"type": "object",
977+
"properties": {
978+
"self": {
979+
"type": "object",
980+
"properties": {
981+
"href": {"type": "string"},
982+
},
983+
"required": [
984+
"href",
985+
]
986+
}
987+
},
988+
"required": [
989+
"self",
990+
]
991+
},
992+
"_embedded": {
993+
"type": "object",
994+
"properties": {
995+
"_instances": {
996+
"type": "array",
997+
"minItems": 1,
998+
"items": DASHBOARD_REPLICATION_GROUP
999+
}
1000+
},
1001+
"required": [
1002+
"_instances",
1003+
]
1004+
},
1005+
1006+
},
1007+
"required": [
1008+
"title",
1009+
"_links",
1010+
"_embedded"
1011+
]
1012+
}
1013+
1014+
DASHBOARD_NODES = {
1015+
"type": "object",
1016+
"properties": {
1017+
"title": {"type": "string"},
1018+
"_links": {
1019+
"type": "object",
1020+
"properties": {
1021+
"self": {
1022+
"type": "object",
1023+
"properties": {
1024+
"href": {"type": "string"},
1025+
},
1026+
"required": [
1027+
"href",
1028+
]
1029+
}
1030+
},
1031+
"required": [
1032+
"self",
1033+
]
1034+
},
1035+
"_embedded": {
1036+
"type": "object",
1037+
"properties": {
1038+
"_instances": {
1039+
"type": "array",
1040+
"minItems": 1,
1041+
}
1042+
},
1043+
"required": [
1044+
"_instances",
1045+
]
1046+
},
1047+
1048+
},
1049+
"required": [
1050+
"title",
1051+
"_links",
1052+
"_embedded"
1053+
]
1054+
}

tests/functional/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def _get_client(self):
3838
username=self.username,
3939
password=self.password,
4040
ecs_endpoint=self.ecs_endpoint,
41-
token_endpoint=self.token_endpoint)
41+
token_endpoint=self.token_endpoint,
42+
request_timeout=60.0)
4243

4344
def setUp(self):
4445
super(BaseTestCase, self).setUp()

tests/functional/test_dashboard.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from ecsclient import schemas
2+
from tests import functional
3+
4+
5+
class TestDashboard(functional.BaseTestCase):
6+
7+
def __test_get_local_zone_replication_groups(self):
8+
response = self.client.dashboard.get_local_zone_replication_groups()
9+
self.assertValidSchema(response, schemas.DASHBOARD_REPLICATION_GROUPS)
10+
11+
def __test_get_local_zone_nodes(self):
12+
response = self.client.dashboard.get_local_zone_nodes()
13+
# TODO: complete the schema to validate the full response
14+
self.assertValidSchema(response, schemas.DASHBOARD_NODES)
15+
16+
def test_get_node_disks(self):
17+
response = self.client.dashboard.get_node_disks()
18+
print(response)
19+
# self.assertValidSchema(response, schemas.DASHBOARD_NODES)

0 commit comments

Comments
 (0)