Skip to content

Commit

Permalink
added test for different units
Browse files Browse the repository at this point in the history
  • Loading branch information
FarajiA committed Jul 20, 2021
1 parent a119928 commit f6958ec
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 0 deletions.
220 changes: 220 additions & 0 deletions test/components/units/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
<html>
<head>
<script src="../../../../dist/hedwig-main.umd.js"></script>
</head>
<body>
<script>
var mockPercentage = [
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-1",
"os": "linux",
"deployment": "prod",
"metricGroup": "cpu",
"unit": "percentage"
},
"values": {
"2020-08-24T00:13:16Z": 90.0,
"2020-08-25T00:13:20Z": 70.0,
"2020-08-26T00:13:21Z": 60.0,
"2020-08-27T00:15:52Z": 84.0,
"2020-08-28T00:15:55Z": 75.0,
"2020-09-01T00:15:52Z": 88.0,
"2020-09-02T00:15:55Z": 67.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-3",
"os": "windows",
"deployment": "dev",
"metricGroup": "cpu",
"unit": "percentage"
},
"values": {
"2020-08-29T00:15:52Z": 88.0,
"2020-08-30T00:15:55Z": 22.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-2",
"os": "123",
"deployment": "staging",
"metricGroup": "cpu",
"unit": "percentage"
},
"values": {
"2020-08-29T00:15:52Z": 65.0,
"2020-08-30T00:15:55Z": 95.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-4",
"os": "abc",
"deployment": "prod",
"metricGroup": "cpu",
"unit": "percentage"
},
"values": {
"2020-09-01T00:15:52Z": 88.0,
"2020-09-02T00:15:55Z": 67.0
}
}}
];

var mockKilobytes = [
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-1",
"os": "linux",
"deployment": "prod",
"metricGroup": "cpu",
"unit": "kilobytes"
},
"values": {
"2020-08-24T00:13:16Z": 90.0,
"2020-08-25T00:13:20Z": 70.0,
"2020-08-26T00:13:21Z": 60.0,
"2020-08-27T00:15:52Z": 84.0,
"2020-08-28T00:15:55Z": 75.0,
"2020-09-01T00:15:52Z": 88.0,
"2020-09-02T00:15:55Z": 67.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-3",
"os": "windows",
"deployment": "dev",
"metricGroup": "cpu",
"unit": "kilobytes"
},
"values": {
"2020-08-29T00:15:52Z": 88.0,
"2020-08-30T00:15:55Z": 22.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-2",
"os": "123",
"deployment": "staging",
"metricGroup": "cpu",
"unit": "kilobytes"
},
"values": {
"2020-08-29T00:15:52Z": 65.0,
"2020-08-30T00:15:55Z": 95.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-4",
"os": "abc",
"deployment": "prod",
"metricGroup": "cpu",
"unit": "kilobytes"
},
"values": {
"2020-09-01T00:15:52Z": 88.0,
"2020-09-02T00:15:55Z": 67.0
}
}}
];


var mockMegabytes = [
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-1",
"os": "linux",
"deployment": "prod",
"metricGroup": "cpu",
"unit": "megabytes"
},
"values": {
"2020-08-24T00:13:16Z": 90.0,
"2020-08-25T00:13:20Z": 70.0,
"2020-08-26T00:13:21Z": 60.0,
"2020-08-27T00:15:52Z": 84.0,
"2020-08-28T00:15:55Z": 75.0,
"2020-09-01T00:15:52Z": 88.0,
"2020-09-02T00:15:55Z": 67.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-3",
"os": "windows",
"deployment": "dev",
"metricGroup": "cpu",
"unit": "megabytes"
},
"values": {
"2020-08-29T00:15:52Z": 88.0,
"2020-08-30T00:15:55Z": 22.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-2",
"os": "123",
"deployment": "staging",
"metricGroup": "cpu",
"unit": "megabytes"
},
"values": {
"2020-08-29T00:15:52Z": 65.0,
"2020-08-30T00:15:55Z": 95.0
}
}},
{ data: {
"tenant": "t-1",
"metricName": "cpu_idle",
"tags": {
"host": "h-4",
"os": "abc",
"deployment": "prod",
"metricGroup": "cpu",
"unit": "megabytes"
},
"values": {
"2020-09-01T00:15:52Z": 88.0,
"2020-09-02T00:15:55Z": 67.0
}
}}
];

document.write('<hedwig-graph data-group="tags.host" data-unit="percentage" data-height="400" data-width="1000" data-graph=' + JSON.stringify(mockPercentage) + '></hedwig-graph>');

document.write('<hedwig-graph data-group="tags.host" data-unit="kilobytes" data-height="400" data-width="1000" data-graph=' + JSON.stringify(mockKilobytes) + '></hedwig-graph>');

document.write('<hedwig-graph data-group="tags.host" data-unit="megabytes" data-height="400" data-width="1000" data-graph=' + JSON.stringify(mockMegabytes) + '></hedwig-graph>');

</script>
</body>
</html>
25 changes: 25 additions & 0 deletions test/components/units/units.vis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var scenarioConfig = {};

scenarioConfig.config = (host, port) =>
{
return {
"label": `Multiple Line Grouping`,
"url": `${host}:${port}/grouping/index.html`,
"referenceUrl": ``,
"readyEvent": ``,
"readySelector": ``,
"delay": 0,
"hideSelectors": [],
"removeSelectors": [],
"hoverSelector": ``,
"clickSelector": ``,
"postInteractionWait": 0,
"selectors": [ ],
"selectorExpansion": true,
"expect": 0,
"misMatchThreshold" : 0.1,
"requireSameDimensions": true
};
};

module.exports = scenarioConfig;

0 comments on commit f6958ec

Please sign in to comment.