aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/benchmark
diff options
context:
space:
mode:
authorPatrice Buriez <patrice.buriez@intel.com>2018-11-09 10:45:31 +0100
committerPatrice Buriez <patrice.buriez@intel.com>2018-11-22 20:18:12 +0100
commit835411e9d454b9672081cb1ff3241c036f204b95 (patch)
tree196ff18ff2df48f2f679f7e9ff5bc6b01f2f45b4 /yardstick/tests/unit/benchmark
parentf4f0862633bfda306d86835325e6572362d7cfdd (diff)
Add parser to support jsTree in report
Allow the user to select what data to show in the report using jsTree to navigate a hierarchical metrics list. JIRA: YARDSTICK-1367 Topic: report/html_table (4 of 11) Change-Id: I86d782a0a70b80a1cdfaab2f41afb7668066cbf7 Signed-off-by: Emma Foley <emma.l.foley@intel.com> Signed-off-by: Patrice Buriez <patrice.buriez@intel.com>
Diffstat (limited to 'yardstick/tests/unit/benchmark')
-rw-r--r--yardstick/tests/unit/benchmark/core/test_report.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/yardstick/tests/unit/benchmark/core/test_report.py b/yardstick/tests/unit/benchmark/core/test_report.py
index 2827f8e26..3e80dcc45 100644
--- a/yardstick/tests/unit/benchmark/core/test_report.py
+++ b/yardstick/tests/unit/benchmark/core/test_report.py
@@ -1,5 +1,6 @@
##############################################################################
# Copyright (c) 2017 Rajesh Kudaka.
+# Copyright (c) 2018 Intel Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -27,6 +28,75 @@ BAD_YAML_NAME = 'F@KE_NAME'
BAD_TASK_ID = 'aaaaaa-aaaaaaaa-aaaaaaaaaa-aaaaaa'
+class JSTreeTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.jstree = report.JSTree()
+
+ def test__create_node(self):
+ _id = "tg__0.DropPackets"
+
+ expected_data = [
+ {"id": "tg__0", "text": "tg__0", "parent": "#"},
+ {"id": "tg__0.DropPackets", "text": "DropPackets", "parent": "tg__0"}
+ ]
+ self.jstree._create_node(_id)
+
+ self.assertEqual(self.jstree._created_nodes, ['#', 'tg__0', 'tg__0.DropPackets'])
+ self.assertEqual(self.jstree.jstree_data, expected_data)
+
+ def test_format_for_jstree(self):
+ data = [
+ {'data': [0, ], 'name': 'tg__0.DropPackets'},
+ {'data': [548, ], 'name': 'tg__0.LatencyAvg.5'},
+ {'data': [1172, ], 'name': 'tg__0.LatencyAvg.6'},
+ {'data': [1001, ], 'name': 'tg__0.LatencyMax.5'},
+ {'data': [1468, ], 'name': 'tg__0.LatencyMax.6'},
+ {'data': [18.11, ], 'name': 'tg__0.RxThroughput'},
+ {'data': [18.11, ], 'name': 'tg__0.TxThroughput'},
+ {'data': [0, ], 'name': 'tg__1.DropPackets'},
+ {'data': [548, ], 'name': 'tg__1.LatencyAvg.5'},
+ {'data': [1172, ], 'name': 'tg__1.LatencyAvg.6'},
+ {'data': [1001, ], 'name': 'tg__1.LatencyMax.5'},
+ {'data': [1468, ], 'name': 'tg__1.LatencyMax.6'},
+ {'data': [18.1132084505, ], 'name': 'tg__1.RxThroughput'},
+ {'data': [18.1157260383, ], 'name': 'tg__1.TxThroughput'},
+ {'data': [9057888, ], 'name': 'vnf__0.curr_packets_in'},
+ {'data': [0, ], 'name': 'vnf__0.packets_dropped'},
+ {'data': [617825443, ], 'name': 'vnf__0.packets_fwd'},
+ ]
+
+ expected_output = [
+ {"id": "tg__0", "text": "tg__0", "parent": "#"},
+ {"id": "tg__0.DropPackets", "text": "DropPackets", "parent": "tg__0"},
+ {"id": "tg__0.LatencyAvg", "text": "LatencyAvg", "parent": "tg__0"},
+ {"id": "tg__0.LatencyAvg.5", "text": "5", "parent": "tg__0.LatencyAvg"},
+ {"id": "tg__0.LatencyAvg.6", "text": "6", "parent": "tg__0.LatencyAvg"},
+ {"id": "tg__0.LatencyMax", "text": "LatencyMax", "parent": "tg__0"},
+ {"id": "tg__0.LatencyMax.5", "text": "5", "parent": "tg__0.LatencyMax"},
+ {"id": "tg__0.LatencyMax.6", "text": "6", "parent": "tg__0.LatencyMax"},
+ {"id": "tg__0.RxThroughput", "text": "RxThroughput", "parent": "tg__0"},
+ {"id": "tg__0.TxThroughput", "text": "TxThroughput", "parent": "tg__0"},
+ {"id": "tg__1", "text": "tg__1", "parent": "#"},
+ {"id": "tg__1.DropPackets", "text": "DropPackets", "parent": "tg__1"},
+ {"id": "tg__1.LatencyAvg", "text": "LatencyAvg", "parent": "tg__1"},
+ {"id": "tg__1.LatencyAvg.5", "text": "5", "parent": "tg__1.LatencyAvg"},
+ {"id": "tg__1.LatencyAvg.6", "text": "6", "parent": "tg__1.LatencyAvg"},
+ {"id": "tg__1.LatencyMax", "text": "LatencyMax", "parent": "tg__1"},
+ {"id": "tg__1.LatencyMax.5", "text": "5", "parent": "tg__1.LatencyMax"},
+ {"id": "tg__1.LatencyMax.6", "text": "6", "parent": "tg__1.LatencyMax"},
+ {"id": "tg__1.RxThroughput", "text": "RxThroughput", "parent": "tg__1"},
+ {"id": "tg__1.TxThroughput", "text": "TxThroughput", "parent": "tg__1"},
+ {"id": "vnf__0", "text": "vnf__0", "parent": "#"},
+ {"id": "vnf__0.curr_packets_in", "text": "curr_packets_in", "parent": "vnf__0"},
+ {"id": "vnf__0.packets_dropped", "text": "packets_dropped", "parent": "vnf__0"},
+ {"id": "vnf__0.packets_fwd", "text": "packets_fwd", "parent": "vnf__0"},
+ ]
+
+ result = self.jstree.format_for_jstree(data)
+ self.assertEqual(expected_output, result)
+
+
class ReportTestCase(unittest.TestCase):
def setUp(self):