Convert tests to jest in vis_type_timeseries/server folder (#54896) (#55032)

* Move vis_data/series tests to jest

* Move tests in request_processors/series to jest

* Move tests in vis_data to jest

* Convert other tests to jest

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Daniil Suleiman 2020-01-17 15:27:15 +03:00 committed by GitHub
parent 14292a10fc
commit aa7b0b2ff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 765 additions and 2806 deletions

View file

@ -1,984 +0,0 @@
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"aggregations": {
"c9b5f9c0-e403-11e6-be91-6f7688e9fac7": {
"doc_count": 128145,
"timeseries": {
"buckets": [
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.057
},
"doc_count": 368,
"key": 1485549090000,
"key_as_string": "2017-01-27T20:31:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.07466666666666667
},
"doc_count": 1106,
"key": 1485549120000,
"key_as_string": "2017-01-27T20:32:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.08033333333333335
},
"doc_count": 1107,
"key": 1485549150000,
"key_as_string": "2017-01-27T20:32:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.066
},
"doc_count": 1109,
"key": 1485549180000,
"key_as_string": "2017-01-27T20:33:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.05366666666666667
},
"doc_count": 1093,
"key": 1485549210000,
"key_as_string": "2017-01-27T20:33:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04533333333333334
},
"doc_count": 1086,
"key": 1485549240000,
"key_as_string": "2017-01-27T20:34:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037333333333333336
},
"doc_count": 1086,
"key": 1485549270000,
"key_as_string": "2017-01-27T20:34:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1090,
"key": 1485549300000,
"key_as_string": "2017-01-27T20:35:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036000000000000004
},
"doc_count": 1085,
"key": 1485549330000,
"key_as_string": "2017-01-27T20:35:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1082,
"key": 1485549360000,
"key_as_string": "2017-01-27T20:36:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1080,
"key": 1485549390000,
"key_as_string": "2017-01-27T20:36:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037000000000000005
},
"doc_count": 1082,
"key": 1485549420000,
"key_as_string": "2017-01-27T20:37:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036000000000000004
},
"doc_count": 1079,
"key": 1485549450000,
"key_as_string": "2017-01-27T20:37:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03233333333333333
},
"doc_count": 1080,
"key": 1485549480000,
"key_as_string": "2017-01-27T20:38:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1080,
"key": 1485549510000,
"key_as_string": "2017-01-27T20:38:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1082,
"key": 1485549540000,
"key_as_string": "2017-01-27T20:39:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.042666666666666665
},
"doc_count": 1079,
"key": 1485549570000,
"key_as_string": "2017-01-27T20:39:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1077,
"key": 1485549600000,
"key_as_string": "2017-01-27T20:40:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03833333333333334
},
"doc_count": 1075,
"key": 1485549630000,
"key_as_string": "2017-01-27T20:40:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1076,
"key": 1485549660000,
"key_as_string": "2017-01-27T20:41:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1076,
"key": 1485549690000,
"key_as_string": "2017-01-27T20:41:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1074,
"key": 1485549720000,
"key_as_string": "2017-01-27T20:42:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1072,
"key": 1485549750000,
"key_as_string": "2017-01-27T20:42:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1067,
"key": 1485549780000,
"key_as_string": "2017-01-27T20:43:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036000000000000004
},
"doc_count": 1065,
"key": 1485549810000,
"key_as_string": "2017-01-27T20:43:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1065,
"key": 1485549840000,
"key_as_string": "2017-01-27T20:44:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036333333333333336
},
"doc_count": 1062,
"key": 1485549870000,
"key_as_string": "2017-01-27T20:44:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1063,
"key": 1485549900000,
"key_as_string": "2017-01-27T20:45:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1065,
"key": 1485549930000,
"key_as_string": "2017-01-27T20:45:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1065,
"key": 1485549960000,
"key_as_string": "2017-01-27T20:46:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1069,
"key": 1485549990000,
"key_as_string": "2017-01-27T20:46:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1068,
"key": 1485550020000,
"key_as_string": "2017-01-27T20:47:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1068,
"key": 1485550050000,
"key_as_string": "2017-01-27T20:47:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1068,
"key": 1485550080000,
"key_as_string": "2017-01-27T20:48:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1074,
"key": 1485550110000,
"key_as_string": "2017-01-27T20:48:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1074,
"key": 1485550140000,
"key_as_string": "2017-01-27T20:49:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1074,
"key": 1485550170000,
"key_as_string": "2017-01-27T20:49:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1073,
"key": 1485550200000,
"key_as_string": "2017-01-27T20:50:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1077,
"key": 1485550230000,
"key_as_string": "2017-01-27T20:50:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03166666666666667
},
"doc_count": 1074,
"key": 1485550260000,
"key_as_string": "2017-01-27T20:51:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.031
},
"doc_count": 1074,
"key": 1485550290000,
"key_as_string": "2017-01-27T20:51:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1072,
"key": 1485550320000,
"key_as_string": "2017-01-27T20:52:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1073,
"key": 1485550350000,
"key_as_string": "2017-01-27T20:52:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1071,
"key": 1485550380000,
"key_as_string": "2017-01-27T20:53:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1071,
"key": 1485550410000,
"key_as_string": "2017-01-27T20:53:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03166666666666667
},
"doc_count": 1069,
"key": 1485550440000,
"key_as_string": "2017-01-27T20:54:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1069,
"key": 1485550470000,
"key_as_string": "2017-01-27T20:54:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.032
},
"doc_count": 1068,
"key": 1485550500000,
"key_as_string": "2017-01-27T20:55:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1067,
"key": 1485550530000,
"key_as_string": "2017-01-27T20:55:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03233333333333333
},
"doc_count": 1065,
"key": 1485550560000,
"key_as_string": "2017-01-27T20:56:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1069,
"key": 1485550590000,
"key_as_string": "2017-01-27T20:56:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03166666666666667
},
"doc_count": 1068,
"key": 1485550620000,
"key_as_string": "2017-01-27T20:57:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1068,
"key": 1485550650000,
"key_as_string": "2017-01-27T20:57:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1068,
"key": 1485550680000,
"key_as_string": "2017-01-27T20:58:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1071,
"key": 1485550710000,
"key_as_string": "2017-01-27T20:58:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1074,
"key": 1485550740000,
"key_as_string": "2017-01-27T20:59:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1074,
"key": 1485550770000,
"key_as_string": "2017-01-27T20:59:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04
},
"doc_count": 1074,
"key": 1485550800000,
"key_as_string": "2017-01-27T21:00:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.032
},
"doc_count": 1076,
"key": 1485550830000,
"key_as_string": "2017-01-27T21:00:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1078,
"key": 1485550860000,
"key_as_string": "2017-01-27T21:01:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1077,
"key": 1485550890000,
"key_as_string": "2017-01-27T21:01:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1071,
"key": 1485550920000,
"key_as_string": "2017-01-27T21:02:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1071,
"key": 1485550950000,
"key_as_string": "2017-01-27T21:02:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03566666666666667
},
"doc_count": 1073,
"key": 1485550980000,
"key_as_string": "2017-01-27T21:03:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1071,
"key": 1485551010000,
"key_as_string": "2017-01-27T21:03:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1069,
"key": 1485551040000,
"key_as_string": "2017-01-27T21:04:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03566666666666667
},
"doc_count": 1068,
"key": 1485551070000,
"key_as_string": "2017-01-27T21:04:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1075,
"key": 1485551100000,
"key_as_string": "2017-01-27T21:05:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1074,
"key": 1485551130000,
"key_as_string": "2017-01-27T21:05:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1073,
"key": 1485551160000,
"key_as_string": "2017-01-27T21:06:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1071,
"key": 1485551190000,
"key_as_string": "2017-01-27T21:06:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1075,
"key": 1485551220000,
"key_as_string": "2017-01-27T21:07:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1071,
"key": 1485551250000,
"key_as_string": "2017-01-27T21:07:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04733333333333334
},
"doc_count": 1081,
"key": 1485551280000,
"key_as_string": "2017-01-27T21:08:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.044333333333333336
},
"doc_count": 1078,
"key": 1485551310000,
"key_as_string": "2017-01-27T21:08:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037000000000000005
},
"doc_count": 1079,
"key": 1485551340000,
"key_as_string": "2017-01-27T21:09:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1077,
"key": 1485551370000,
"key_as_string": "2017-01-27T21:09:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03866666666666666
},
"doc_count": 1077,
"key": 1485551400000,
"key_as_string": "2017-01-27T21:10:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037666666666666675
},
"doc_count": 1075,
"key": 1485551430000,
"key_as_string": "2017-01-27T21:10:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.038000000000000006
},
"doc_count": 1078,
"key": 1485551460000,
"key_as_string": "2017-01-27T21:11:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037
},
"doc_count": 1074,
"key": 1485551490000,
"key_as_string": "2017-01-27T21:11:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036666666666666674
},
"doc_count": 1074,
"key": 1485551520000,
"key_as_string": "2017-01-27T21:12:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037333333333333336
},
"doc_count": 1076,
"key": 1485551550000,
"key_as_string": "2017-01-27T21:12:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03733333333333333
},
"doc_count": 1075,
"key": 1485551580000,
"key_as_string": "2017-01-27T21:13:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04533333333333334
},
"doc_count": 1077,
"key": 1485551610000,
"key_as_string": "2017-01-27T21:13:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.039
},
"doc_count": 1080,
"key": 1485551640000,
"key_as_string": "2017-01-27T21:14:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.057666666666666665
},
"doc_count": 1080,
"key": 1485551670000,
"key_as_string": "2017-01-27T21:14:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.045000000000000005
},
"doc_count": 1080,
"key": 1485551700000,
"key_as_string": "2017-01-27T21:15:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037666666666666675
},
"doc_count": 1080,
"key": 1485551730000,
"key_as_string": "2017-01-27T21:15:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1080,
"key": 1485551760000,
"key_as_string": "2017-01-27T21:16:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.038
},
"doc_count": 1080,
"key": 1485551790000,
"key_as_string": "2017-01-27T21:16:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1080,
"key": 1485551820000,
"key_as_string": "2017-01-27T21:17:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04966666666666667
},
"doc_count": 1080,
"key": 1485551850000,
"key_as_string": "2017-01-27T21:17:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1080,
"key": 1485551880000,
"key_as_string": "2017-01-27T21:18:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04
},
"doc_count": 1080,
"key": 1485551910000,
"key_as_string": "2017-01-27T21:18:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03766666666666666
},
"doc_count": 1080,
"key": 1485551940000,
"key_as_string": "2017-01-27T21:19:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1076,
"key": 1485551970000,
"key_as_string": "2017-01-27T21:19:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1077,
"key": 1485552000000,
"key_as_string": "2017-01-27T21:20:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1077,
"key": 1485552030000,
"key_as_string": "2017-01-27T21:20:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.029666666666666664
},
"doc_count": 1077,
"key": 1485552060000,
"key_as_string": "2017-01-27T21:21:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.02766666666666667
},
"doc_count": 1077,
"key": 1485552090000,
"key_as_string": "2017-01-27T21:21:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.028
},
"doc_count": 1077,
"key": 1485552120000,
"key_as_string": "2017-01-27T21:22:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.030666666666666665
},
"doc_count": 1077,
"key": 1485552150000,
"key_as_string": "2017-01-27T21:22:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03833333333333334
},
"doc_count": 1083,
"key": 1485552180000,
"key_as_string": "2017-01-27T21:23:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04966666666666667
},
"doc_count": 1083,
"key": 1485552210000,
"key_as_string": "2017-01-27T21:23:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.041
},
"doc_count": 1082,
"key": 1485552240000,
"key_as_string": "2017-01-27T21:24:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037333333333333336
},
"doc_count": 1087,
"key": 1485552270000,
"key_as_string": "2017-01-27T21:24:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.039
},
"doc_count": 1083,
"key": 1485552300000,
"key_as_string": "2017-01-27T21:25:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03933333333333333
},
"doc_count": 1083,
"key": 1485552330000,
"key_as_string": "2017-01-27T21:25:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037666666666666675
},
"doc_count": 1083,
"key": 1485552360000,
"key_as_string": "2017-01-27T21:26:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04033333333333333
},
"doc_count": 1083,
"key": 1485552390000,
"key_as_string": "2017-01-27T21:26:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03866666666666666
},
"doc_count": 1082,
"key": 1485552420000,
"key_as_string": "2017-01-27T21:27:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04033333333333334
},
"doc_count": 1083,
"key": 1485552450000,
"key_as_string": "2017-01-27T21:27:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04
},
"doc_count": 1083,
"key": 1485552480000,
"key_as_string": "2017-01-27T21:28:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04033333333333333
},
"doc_count": 1084,
"key": 1485552510000,
"key_as_string": "2017-01-27T21:28:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1083,
"key": 1485552540000,
"key_as_string": "2017-01-27T21:29:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03566666666666667
},
"doc_count": 1083,
"key": 1485552570000,
"key_as_string": "2017-01-27T21:29:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04466666666666667
},
"doc_count": 1083,
"key": 1485552600000,
"key_as_string": "2017-01-27T21:30:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03233333333333333
},
"doc_count": 1083,
"key": 1485552630000,
"key_as_string": "2017-01-27T21:30:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.0505
},
"doc_count": 722,
"key": 1485552660000,
"key_as_string": "2017-01-27T21:31:00.000Z"
}
]
}
}
},
"hits": {
"hits": [],
"max_score": 0,
"total": 128145
},
"status": 200,
"timed_out": false,
"took": 28
}

View file

@ -1,985 +0,0 @@
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"aggregations": {
"c9b5f9c0-e403-11e6-be91-6f7688e9fac7": {
"doc_count": 128145,
"timeseries": {
"buckets": [
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.057
},
"doc_count": 368,
"key": 1485549090000,
"key_as_string": "2017-01-27T20:31:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.07466666666666667
},
"doc_count": 1106,
"key": 1485549120000,
"key_as_string": "2017-01-27T20:32:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.08033333333333335
},
"doc_count": 1107,
"key": 1485549150000,
"key_as_string": "2017-01-27T20:32:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.066
},
"doc_count": 1109,
"key": 1485549180000,
"key_as_string": "2017-01-27T20:33:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.05366666666666667
},
"doc_count": 1093,
"key": 1485549210000,
"key_as_string": "2017-01-27T20:33:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04533333333333334
},
"doc_count": 1086,
"key": 1485549240000,
"key_as_string": "2017-01-27T20:34:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037333333333333336
},
"doc_count": 1086,
"key": 1485549270000,
"key_as_string": "2017-01-27T20:34:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1090,
"key": 1485549300000,
"key_as_string": "2017-01-27T20:35:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036000000000000004
},
"doc_count": 1085,
"key": 1485549330000,
"key_as_string": "2017-01-27T20:35:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1082,
"key": 1485549360000,
"key_as_string": "2017-01-27T20:36:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1080,
"key": 1485549390000,
"key_as_string": "2017-01-27T20:36:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037000000000000005
},
"doc_count": 1082,
"key": 1485549420000,
"key_as_string": "2017-01-27T20:37:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036000000000000004
},
"doc_count": 1079,
"key": 1485549450000,
"key_as_string": "2017-01-27T20:37:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03233333333333333
},
"doc_count": 1080,
"key": 1485549480000,
"key_as_string": "2017-01-27T20:38:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1080,
"key": 1485549510000,
"key_as_string": "2017-01-27T20:38:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1082,
"key": 1485549540000,
"key_as_string": "2017-01-27T20:39:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.042666666666666665
},
"doc_count": 1079,
"key": 1485549570000,
"key_as_string": "2017-01-27T20:39:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1077,
"key": 1485549600000,
"key_as_string": "2017-01-27T20:40:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03833333333333334
},
"doc_count": 1075,
"key": 1485549630000,
"key_as_string": "2017-01-27T20:40:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1076,
"key": 1485549660000,
"key_as_string": "2017-01-27T20:41:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1076,
"key": 1485549690000,
"key_as_string": "2017-01-27T20:41:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1074,
"key": 1485549720000,
"key_as_string": "2017-01-27T20:42:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1072,
"key": 1485549750000,
"key_as_string": "2017-01-27T20:42:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1067,
"key": 1485549780000,
"key_as_string": "2017-01-27T20:43:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036000000000000004
},
"doc_count": 1065,
"key": 1485549810000,
"key_as_string": "2017-01-27T20:43:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1065,
"key": 1485549840000,
"key_as_string": "2017-01-27T20:44:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036333333333333336
},
"doc_count": 1062,
"key": 1485549870000,
"key_as_string": "2017-01-27T20:44:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1063,
"key": 1485549900000,
"key_as_string": "2017-01-27T20:45:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1065,
"key": 1485549930000,
"key_as_string": "2017-01-27T20:45:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1065,
"key": 1485549960000,
"key_as_string": "2017-01-27T20:46:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1069,
"key": 1485549990000,
"key_as_string": "2017-01-27T20:46:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1068,
"key": 1485550020000,
"key_as_string": "2017-01-27T20:47:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1068,
"key": 1485550050000,
"key_as_string": "2017-01-27T20:47:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1068,
"key": 1485550080000,
"key_as_string": "2017-01-27T20:48:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1074,
"key": 1485550110000,
"key_as_string": "2017-01-27T20:48:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1074,
"key": 1485550140000,
"key_as_string": "2017-01-27T20:49:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1074,
"key": 1485550170000,
"key_as_string": "2017-01-27T20:49:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1073,
"key": 1485550200000,
"key_as_string": "2017-01-27T20:50:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1077,
"key": 1485550230000,
"key_as_string": "2017-01-27T20:50:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03166666666666667
},
"doc_count": 1074,
"key": 1485550260000,
"key_as_string": "2017-01-27T20:51:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.031
},
"doc_count": 1074,
"key": 1485550290000,
"key_as_string": "2017-01-27T20:51:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1072,
"key": 1485550320000,
"key_as_string": "2017-01-27T20:52:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.033
},
"doc_count": 1073,
"key": 1485550350000,
"key_as_string": "2017-01-27T20:52:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1071,
"key": 1485550380000,
"key_as_string": "2017-01-27T20:53:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1071,
"key": 1485550410000,
"key_as_string": "2017-01-27T20:53:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03166666666666667
},
"doc_count": 1069,
"key": 1485550440000,
"key_as_string": "2017-01-27T20:54:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1069,
"key": 1485550470000,
"key_as_string": "2017-01-27T20:54:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.032
},
"doc_count": 1068,
"key": 1485550500000,
"key_as_string": "2017-01-27T20:55:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1067,
"key": 1485550530000,
"key_as_string": "2017-01-27T20:55:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03233333333333333
},
"doc_count": 1065,
"key": 1485550560000,
"key_as_string": "2017-01-27T20:56:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1069,
"key": 1485550590000,
"key_as_string": "2017-01-27T20:56:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03166666666666667
},
"doc_count": 1068,
"key": 1485550620000,
"key_as_string": "2017-01-27T20:57:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1068,
"key": 1485550650000,
"key_as_string": "2017-01-27T20:57:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1068,
"key": 1485550680000,
"key_as_string": "2017-01-27T20:58:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1071,
"key": 1485550710000,
"key_as_string": "2017-01-27T20:58:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1074,
"key": 1485550740000,
"key_as_string": "2017-01-27T20:59:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1074,
"key": 1485550770000,
"key_as_string": "2017-01-27T20:59:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04
},
"doc_count": 1074,
"key": 1485550800000,
"key_as_string": "2017-01-27T21:00:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.032
},
"doc_count": 1076,
"key": 1485550830000,
"key_as_string": "2017-01-27T21:00:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1078,
"key": 1485550860000,
"key_as_string": "2017-01-27T21:01:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1077,
"key": 1485550890000,
"key_as_string": "2017-01-27T21:01:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1071,
"key": 1485550920000,
"key_as_string": "2017-01-27T21:02:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1071,
"key": 1485550950000,
"key_as_string": "2017-01-27T21:02:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03566666666666667
},
"doc_count": 1073,
"key": 1485550980000,
"key_as_string": "2017-01-27T21:03:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1071,
"key": 1485551010000,
"key_as_string": "2017-01-27T21:03:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03466666666666667
},
"doc_count": 1069,
"key": 1485551040000,
"key_as_string": "2017-01-27T21:04:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03566666666666667
},
"doc_count": 1068,
"key": 1485551070000,
"key_as_string": "2017-01-27T21:04:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1075,
"key": 1485551100000,
"key_as_string": "2017-01-27T21:05:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1074,
"key": 1485551130000,
"key_as_string": "2017-01-27T21:05:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1073,
"key": 1485551160000,
"key_as_string": "2017-01-27T21:06:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1071,
"key": 1485551190000,
"key_as_string": "2017-01-27T21:06:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1075,
"key": 1485551220000,
"key_as_string": "2017-01-27T21:07:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03133333333333333
},
"doc_count": 1071,
"key": 1485551250000,
"key_as_string": "2017-01-27T21:07:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04733333333333334
},
"doc_count": 1081,
"key": 1485551280000,
"key_as_string": "2017-01-27T21:08:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.044333333333333336
},
"doc_count": 1078,
"key": 1485551310000,
"key_as_string": "2017-01-27T21:08:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037000000000000005
},
"doc_count": 1079,
"key": 1485551340000,
"key_as_string": "2017-01-27T21:09:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1077,
"key": 1485551370000,
"key_as_string": "2017-01-27T21:09:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03866666666666666
},
"doc_count": 1077,
"key": 1485551400000,
"key_as_string": "2017-01-27T21:10:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037666666666666675
},
"doc_count": 1075,
"key": 1485551430000,
"key_as_string": "2017-01-27T21:10:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.038000000000000006
},
"doc_count": 1078,
"key": 1485551460000,
"key_as_string": "2017-01-27T21:11:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037
},
"doc_count": 1074,
"key": 1485551490000,
"key_as_string": "2017-01-27T21:11:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.036666666666666674
},
"doc_count": 1074,
"key": 1485551520000,
"key_as_string": "2017-01-27T21:12:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037333333333333336
},
"doc_count": 1076,
"key": 1485551550000,
"key_as_string": "2017-01-27T21:12:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03733333333333333
},
"doc_count": 1075,
"key": 1485551580000,
"key_as_string": "2017-01-27T21:13:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04533333333333334
},
"doc_count": 1077,
"key": 1485551610000,
"key_as_string": "2017-01-27T21:13:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.039
},
"doc_count": 1080,
"key": 1485551640000,
"key_as_string": "2017-01-27T21:14:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.057666666666666665
},
"doc_count": 1080,
"key": 1485551670000,
"key_as_string": "2017-01-27T21:14:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.045000000000000005
},
"doc_count": 1080,
"key": 1485551700000,
"key_as_string": "2017-01-27T21:15:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037666666666666675
},
"doc_count": 1080,
"key": 1485551730000,
"key_as_string": "2017-01-27T21:15:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1080,
"key": 1485551760000,
"key_as_string": "2017-01-27T21:16:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.038
},
"doc_count": 1080,
"key": 1485551790000,
"key_as_string": "2017-01-27T21:16:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1080,
"key": 1485551820000,
"key_as_string": "2017-01-27T21:17:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04966666666666667
},
"doc_count": 1080,
"key": 1485551850000,
"key_as_string": "2017-01-27T21:17:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03266666666666667
},
"doc_count": 1080,
"key": 1485551880000,
"key_as_string": "2017-01-27T21:18:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04
},
"doc_count": 1080,
"key": 1485551910000,
"key_as_string": "2017-01-27T21:18:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03766666666666666
},
"doc_count": 1080,
"key": 1485551940000,
"key_as_string": "2017-01-27T21:19:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034
},
"doc_count": 1076,
"key": 1485551970000,
"key_as_string": "2017-01-27T21:19:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.034333333333333334
},
"doc_count": 1077,
"key": 1485552000000,
"key_as_string": "2017-01-27T21:20:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03366666666666667
},
"doc_count": 1077,
"key": 1485552030000,
"key_as_string": "2017-01-27T21:20:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.029666666666666664
},
"doc_count": 1077,
"key": 1485552060000,
"key_as_string": "2017-01-27T21:21:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.02766666666666667
},
"doc_count": 1077,
"key": 1485552090000,
"key_as_string": "2017-01-27T21:21:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.028
},
"doc_count": 1077,
"key": 1485552120000,
"key_as_string": "2017-01-27T21:22:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.030666666666666665
},
"doc_count": 1077,
"key": 1485552150000,
"key_as_string": "2017-01-27T21:22:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03833333333333334
},
"doc_count": 1083,
"key": 1485552180000,
"key_as_string": "2017-01-27T21:23:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04966666666666667
},
"doc_count": 1083,
"key": 1485552210000,
"key_as_string": "2017-01-27T21:23:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.041
},
"doc_count": 1082,
"key": 1485552240000,
"key_as_string": "2017-01-27T21:24:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037333333333333336
},
"doc_count": 1087,
"key": 1485552270000,
"key_as_string": "2017-01-27T21:24:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.039
},
"doc_count": 1083,
"key": 1485552300000,
"key_as_string": "2017-01-27T21:25:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03933333333333333
},
"doc_count": 1083,
"key": 1485552330000,
"key_as_string": "2017-01-27T21:25:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.037666666666666675
},
"doc_count": 1083,
"key": 1485552360000,
"key_as_string": "2017-01-27T21:26:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04033333333333333
},
"doc_count": 1083,
"key": 1485552390000,
"key_as_string": "2017-01-27T21:26:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03866666666666666
},
"doc_count": 1082,
"key": 1485552420000,
"key_as_string": "2017-01-27T21:27:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04033333333333334
},
"doc_count": 1083,
"key": 1485552450000,
"key_as_string": "2017-01-27T21:27:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04
},
"doc_count": 1083,
"key": 1485552480000,
"key_as_string": "2017-01-27T21:28:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04033333333333333
},
"doc_count": 1084,
"key": 1485552510000,
"key_as_string": "2017-01-27T21:28:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03333333333333333
},
"doc_count": 1083,
"key": 1485552540000,
"key_as_string": "2017-01-27T21:29:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03566666666666667
},
"doc_count": 1083,
"key": 1485552570000,
"key_as_string": "2017-01-27T21:29:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.04466666666666667
},
"doc_count": 1083,
"key": 1485552600000,
"key_as_string": "2017-01-27T21:30:00.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.03233333333333333
},
"doc_count": 1083,
"key": 1485552630000,
"key_as_string": "2017-01-27T21:30:30.000Z"
},
{
"c9b5f9c1-e403-11e6-be91-6f7688e9fac7": {
"value": 0.0505
},
"doc_count": 722,
"key": 1485552660000,
"key_as_string": "2017-01-27T21:31:00.000Z"
}
]
}
}
},
"hits": {
"hits": [],
"max_score": 0,
"total": 128145
},
"status": 200,
"timed_out": false,
"took": 28
}

View file

@ -1,388 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { expect } from 'chai';
import { bucketTransform } from '../../helpers/bucket_transform';
describe('bucketTransform', () => {
describe('count', () => {
it('returns count agg', () => {
const metric = { id: 'test', type: 'count' };
const fn = bucketTransform.count;
expect(fn(metric)).to.eql({
bucket_script: {
buckets_path: { count: '_count' },
script: { source: 'count * 1', lang: 'expression' },
gap_policy: 'skip',
},
});
});
});
describe('std metric', () => {
['avg', 'max', 'min', 'sum', 'cardinality', 'value_count'].forEach(type => {
it(`returns ${type} agg`, () => {
const metric = { id: 'test', type: type, field: 'cpu.pct' };
const fn = bucketTransform[type];
const result = {};
result[type] = { field: 'cpu.pct' };
expect(fn(metric)).to.eql(result);
});
});
it('throws error if type is missing', () => {
const run = () => bucketTransform.avg({ id: 'test', field: 'cpu.pct' });
expect(run).to.throw(Error, 'Metric missing type');
});
it('throws error if field is missing', () => {
const run = () => bucketTransform.avg({ id: 'test', type: 'avg' });
expect(run).to.throw(Error, 'Metric missing field');
});
});
describe('extended stats', () => {
['std_deviation', 'variance', 'sum_of_squares'].forEach(type => {
it(`returns ${type} agg`, () => {
const fn = bucketTransform[type];
const metric = { id: 'test', type: type, field: 'cpu.pct' };
expect(fn(metric)).to.eql({ extended_stats: { field: 'cpu.pct' } });
});
});
it('returns std_deviation agg with sigma', () => {
const fn = bucketTransform.std_deviation;
const metric = {
id: 'test',
type: 'std_deviation',
field: 'cpu.pct',
sigma: 2,
};
expect(fn(metric)).to.eql({
extended_stats: { field: 'cpu.pct', sigma: 2 },
});
});
it('throws error if type is missing', () => {
const run = () => bucketTransform.std_deviation({ id: 'test', field: 'cpu.pct' });
expect(run).to.throw(Error, 'Metric missing type');
});
it('throws error if field is missing', () => {
const run = () => bucketTransform.std_deviation({ id: 'test', type: 'avg' });
expect(run).to.throw(Error, 'Metric missing field');
});
});
describe('percentiles', () => {
it('returns percentiles agg', () => {
const metric = {
id: 'test',
type: 'percentile',
field: 'cpu.pct',
percentiles: [
{ value: 50, mode: 'line' },
{ value: 10, mode: 'band', percentile: 90 },
],
};
const fn = bucketTransform.percentile;
expect(fn(metric)).to.eql({
percentiles: {
field: 'cpu.pct',
percents: [50, 10, 90],
},
});
});
it('define a default 0 value if it was not provided', () => {
const metric = {
id: 'test',
type: 'percentile',
field: 'cpu.pct',
percentiles: [
{ value: 50, mode: 'line' },
{ mode: 'line' },
{ value: undefined, mode: 'line' },
{ value: '', mode: 'line' },
{ value: null, mode: 'line' },
{ value: 0, mode: 'line' },
],
};
expect(bucketTransform.percentile(metric)).to.eql({
percentiles: {
field: 'cpu.pct',
percents: [50, 0, 0, 0, 0, 0],
},
});
});
it('throws error if type is missing', () => {
const run = () =>
bucketTransform.percentile({
id: 'test',
field: 'cpu.pct',
percentiles: [{ value: 50, mode: 'line' }],
});
expect(run).to.throw(Error, 'Metric missing type');
});
it('throws error if field is missing', () => {
const run = () =>
bucketTransform.percentile({
id: 'test',
type: 'avg',
percentiles: [{ value: 50, mode: 'line' }],
});
expect(run).to.throw(Error, 'Metric missing field');
});
it('throws error if percentiles is missing', () => {
const run = () =>
bucketTransform.percentile({
id: 'test',
type: 'avg',
field: 'cpu.pct',
});
expect(run).to.throw(Error, 'Metric missing percentiles');
});
});
describe('derivative', () => {
it('returns derivative agg with defaults', () => {
const metric = {
id: '2',
type: 'derivative',
field: '1',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.derivative;
expect(fn(metric, metrics, '10s')).is.eql({
derivative: {
buckets_path: '1',
gap_policy: 'skip',
unit: '10s',
},
});
});
it('returns derivative agg with unit', () => {
const metric = {
id: '2',
type: 'derivative',
field: '1',
unit: '1s',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.derivative;
expect(fn(metric, metrics, '10s')).is.eql({
derivative: {
buckets_path: '1',
gap_policy: 'skip',
unit: '1s',
},
});
});
it('returns derivative agg with gap_policy', () => {
const metric = {
id: '2',
type: 'derivative',
field: '1',
gap_policy: 'zero_fill',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.derivative;
expect(fn(metric, metrics, '10s')).is.eql({
derivative: {
buckets_path: '1',
gap_policy: 'zero_fill',
unit: '10s',
},
});
});
it('throws error if type is missing', () => {
const run = () => bucketTransform.derivative({ id: 'test', field: 'cpu.pct' });
expect(run).to.throw(Error, 'Metric missing type');
});
it('throws error if field is missing', () => {
const run = () => bucketTransform.derivative({ id: 'test', type: 'derivative' });
expect(run).to.throw(Error, 'Metric missing field');
});
});
describe('serial_diff', () => {
it('returns serial_diff agg with defaults', () => {
const metric = {
id: '2',
type: 'serial_diff',
field: '1',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.serial_diff;
expect(fn(metric, metrics)).is.eql({
serial_diff: {
buckets_path: '1',
gap_policy: 'skip',
lag: 1,
},
});
});
it('returns serial_diff agg with lag', () => {
const metric = {
id: '2',
type: 'serial_diff',
field: '1',
lag: 10,
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.serial_diff;
expect(fn(metric, metrics)).is.eql({
serial_diff: {
buckets_path: '1',
gap_policy: 'skip',
lag: 10,
},
});
});
it('returns serial_diff agg with gap_policy', () => {
const metric = {
id: '2',
type: 'serial_diff',
field: '1',
gap_policy: 'zero_fill',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.serial_diff;
expect(fn(metric, metrics)).is.eql({
serial_diff: {
buckets_path: '1',
gap_policy: 'zero_fill',
lag: 1,
},
});
});
it('throws error if type is missing', () => {
const run = () => bucketTransform.serial_diff({ id: 'test', field: 'cpu.pct' });
expect(run).to.throw(Error, 'Metric missing type');
});
it('throws error if field is missing', () => {
const run = () => bucketTransform.serial_diff({ id: 'test', type: 'serial_diff' });
expect(run).to.throw(Error, 'Metric missing field');
});
});
describe('cumulative_sum', () => {
it('returns cumulative_sum agg', () => {
const metric = { id: '2', type: 'cumulative_sum', field: '1' };
const metrics = [{ id: '1', type: 'sum', field: 'cpu.pct' }, metric];
const fn = bucketTransform.cumulative_sum;
expect(fn(metric, metrics, '10s')).is.eql({
cumulative_sum: { buckets_path: '1' },
});
});
it('throws error if type is missing', () => {
const run = () => bucketTransform.cumulative_sum({ id: 'test', field: 'cpu.pct' });
expect(run).to.throw(Error, 'Metric missing type');
});
it('throws error if field is missing', () => {
const run = () => bucketTransform.cumulative_sum({ id: 'test', type: 'cumulative_sum' });
expect(run).to.throw(Error, 'Metric missing field');
});
});
describe('calculation', () => {
it('returns calculation(bucket_script)', () => {
const metric = {
id: '2',
type: 'calculation',
script: 'params.idle != null ? 1 - params.idle : 0',
variables: [{ name: 'idle', field: '1' }],
};
const metrics = [{ id: '1', type: 'avg', field: 'cpu.idle.pct' }, metric];
const fn = bucketTransform.calculation;
expect(fn(metric, metrics, '10s')).is.eql({
bucket_script: {
buckets_path: {
idle: '1',
},
gap_policy: 'skip',
script: {
source: 'params.idle != null ? 1 - params.idle : 0',
lang: 'painless',
params: {
_interval: 10000,
},
},
},
});
});
it('throws error if variables is missing', () => {
const run = () =>
bucketTransform.calculation({
id: 'test',
type: 'calculation',
script: 'params.idle != null ? 1 - params.idle : null',
});
expect(run).to.throw(Error, 'Metric missing variables');
});
it('throws error if script is missing', () => {
const run = () =>
bucketTransform.calculation({
id: 'test',
type: 'calculation',
variables: [{ field: '1', name: 'idle' }],
});
expect(run).to.throw(Error, 'Metric missing script');
});
});
describe('positive_only', () => {
it('returns bucket_script', () => {
const metric = {
id: '2',
type: 'positive_only',
field: '1',
};
const metrics = [{ id: '1', type: 'avg', field: 'cpu.idle.pct' }, metric];
const fn = bucketTransform.positive_only;
expect(fn(metric, metrics, '10s')).is.eql({
bucket_script: {
buckets_path: {
value: '1',
},
gap_policy: 'skip',
script: {
source: 'params.value > 0.0 ? params.value : 0.0',
lang: 'painless',
},
},
});
});
});
});

View file

@ -17,43 +17,41 @@
* under the License.
*/
import sinon from 'sinon';
import { expect } from 'chai';
import { buildProcessorFunction } from '../build_processor_function';
import { buildProcessorFunction } from './build_processor_function';
describe('buildProcessorFunction(chain, ...args)', () => {
const req = {};
const panel = {};
const series = {};
it('should call each processor', () => {
const first = sinon.spy(() => next => doc => next(doc));
const second = sinon.spy(() => next => doc => next(doc));
test('should call each processor', () => {
const first = jest.fn(() => (next: any) => (doc: any) => next(doc));
const second = jest.fn(() => (next: any) => (doc: any) => next(doc));
buildProcessorFunction([first, second], req, panel, series);
expect(first.calledOnce).to.equal(true);
expect(second.calledOnce).to.equal(true);
expect(first.mock.calls.length).toEqual(1);
expect(second.mock.calls.length).toEqual(1);
});
it('should chain each processor', () => {
const first = sinon.spy(next => doc => next(doc));
const second = sinon.spy(next => doc => next(doc));
test('should chain each processor', () => {
const first = jest.fn(() => (next: any) => (doc: any) => next(doc));
const second = jest.fn(() => (next: any) => (doc: any) => next(doc));
buildProcessorFunction([() => first, () => second], req, panel, series);
expect(first.calledOnce).to.equal(true);
expect(second.calledOnce).to.equal(true);
expect(first.mock.calls.length).toEqual(1);
expect(second.mock.calls.length).toEqual(1);
});
it('should next of each processor', () => {
const first = sinon.spy();
const second = sinon.spy();
test('should next of each processor', () => {
const first = jest.fn();
const second = jest.fn();
const fn = buildProcessorFunction(
[
() => next => doc => {
() => (next: any) => (doc: any) => {
first();
next(doc);
},
() => next => doc => {
() => (next: any) => (doc: any) => {
second();
next(doc);
},
@ -63,7 +61,7 @@ describe('buildProcessorFunction(chain, ...args)', () => {
series
);
fn({});
expect(first.calledOnce).to.equal(true);
expect(second.calledOnce).to.equal(true);
expect(first.mock.calls.length).toEqual(1);
expect(second.mock.calls.length).toEqual(1);
});
});

View file

@ -17,11 +17,9 @@
* under the License.
*/
export function buildProcessorFunction(chain, ...args) {
export function buildProcessorFunction(chain: any[], ...args: any) {
return chain.reduceRight(
(next, fn) => {
return fn(...args)(next);
},
doc => doc
(next, fn) => fn(...args)(next),
(doc: any) => doc
);
}

View file

@ -17,27 +17,26 @@
* under the License.
*/
import { expect } from 'chai';
import { getIntervalAndTimefield } from '../get_interval_and_timefield';
import { getIntervalAndTimefield } from './get_interval_and_timefield';
describe('getIntervalAndTimefield(panel, series)', () => {
it('returns the panel interval and timefield', () => {
test('returns the panel interval and timefield', () => {
const panel = { time_field: '@timestamp', interval: 'auto' };
const series = {};
expect(getIntervalAndTimefield(panel, series)).to.eql({
expect(getIntervalAndTimefield(panel, series)).toEqual({
timeField: '@timestamp',
interval: 'auto',
});
});
it('returns the series interval and timefield', () => {
test('returns the series interval and timefield', () => {
const panel = { time_field: '@timestamp', interval: 'auto' };
const series = {
override_index_pattern: true,
series_interval: '1m',
series_time_field: 'time',
};
expect(getIntervalAndTimefield(panel, series)).to.eql({
expect(getIntervalAndTimefield(panel, series)).toEqual({
timeField: 'time',
interval: '1m',
});

View file

@ -94,4 +94,371 @@ describe('src/legacy/core_plugins/metrics/server/lib/vis_data/helpers/bucket_tra
});
});
});
describe('bucketTransform additional', () => {
describe('count', () => {
test('returns count agg', () => {
const metric = { id: 'test', type: 'count' };
const fn = bucketTransform.count;
expect(fn(metric)).toEqual({
bucket_script: {
buckets_path: { count: '_count' },
script: { source: 'count * 1', lang: 'expression' },
gap_policy: 'skip',
},
});
});
});
describe('std metric', () => {
['avg', 'max', 'min', 'sum', 'cardinality', 'value_count'].forEach(type => {
test(`returns ${type} agg`, () => {
const metric = { id: 'test', type: type, field: 'cpu.pct' };
const fn = bucketTransform[type];
const result = {};
result[type] = { field: 'cpu.pct' };
expect(fn(metric)).toEqual(result);
});
});
test('throws error if type is missing', () => {
const run = () => bucketTransform.avg({ id: 'test', field: 'cpu.pct' });
expect(run).toThrow(new Error('Metric missing type'));
});
test('throws error if field is missing', () => {
const run = () => bucketTransform.avg({ id: 'test', type: 'avg' });
expect(run).toThrow(new Error('Metric missing field'));
});
});
describe('extended stats', () => {
['std_deviation', 'variance', 'sum_of_squares'].forEach(type => {
test(`returns ${type} agg`, () => {
const fn = bucketTransform[type];
const metric = { id: 'test', type: type, field: 'cpu.pct' };
expect(fn(metric)).toEqual({ extended_stats: { field: 'cpu.pct' } });
});
});
test('returns std_deviation agg with sigma', () => {
const fn = bucketTransform.std_deviation;
const metric = {
id: 'test',
type: 'std_deviation',
field: 'cpu.pct',
sigma: 2,
};
expect(fn(metric)).toEqual({
extended_stats: { field: 'cpu.pct', sigma: 2 },
});
});
test('throws error if type is missing', () => {
const run = () => bucketTransform.std_deviation({ id: 'test', field: 'cpu.pct' });
expect(run).toThrow(new Error('Metric missing type'));
});
test('throws error if field is missing', () => {
const run = () => bucketTransform.std_deviation({ id: 'test', type: 'avg' });
expect(run).toThrow(new Error('Metric missing field'));
});
});
describe('percentiles', () => {
test('returns percentiles agg', () => {
const metric = {
id: 'test',
type: 'percentile',
field: 'cpu.pct',
percentiles: [
{ value: 50, mode: 'line' },
{ value: 10, mode: 'band', percentile: 90 },
],
};
const fn = bucketTransform.percentile;
expect(fn(metric)).toEqual({
percentiles: {
field: 'cpu.pct',
percents: [50, 10, 90],
},
});
});
test('define a default 0 value if it was not provided', () => {
const metric = {
id: 'test',
type: 'percentile',
field: 'cpu.pct',
percentiles: [
{ value: 50, mode: 'line' },
{ mode: 'line' },
{ value: undefined, mode: 'line' },
{ value: '', mode: 'line' },
{ value: null, mode: 'line' },
{ value: 0, mode: 'line' },
],
};
expect(bucketTransform.percentile(metric)).toEqual({
percentiles: {
field: 'cpu.pct',
percents: [50, 0, 0, 0, 0, 0],
},
});
});
test('throws error if type is missing', () => {
const run = () =>
bucketTransform.percentile({
id: 'test',
field: 'cpu.pct',
percentiles: [{ value: 50, mode: 'line' }],
});
expect(run).toThrow(new Error('Metric missing type'));
});
test('throws error if field is missing', () => {
const run = () =>
bucketTransform.percentile({
id: 'test',
type: 'avg',
percentiles: [{ value: 50, mode: 'line' }],
});
expect(run).toThrow(new Error('Metric missing field'));
});
test('throws error if percentiles is missing', () => {
const run = () =>
bucketTransform.percentile({
id: 'test',
type: 'avg',
field: 'cpu.pct',
});
expect(run).toThrow(new Error('Metric missing percentiles'));
});
});
describe('derivative', () => {
test('returns derivative agg with defaults', () => {
const metric = {
id: '2',
type: 'derivative',
field: '1',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.derivative;
expect(fn(metric, metrics, '10s')).toEqual({
derivative: {
buckets_path: '1',
gap_policy: 'skip',
unit: '10s',
},
});
});
test('returns derivative agg with unit', () => {
const metric = {
id: '2',
type: 'derivative',
field: '1',
unit: '1s',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.derivative;
expect(fn(metric, metrics, '10s')).toEqual({
derivative: {
buckets_path: '1',
gap_policy: 'skip',
unit: '1s',
},
});
});
test('returns derivative agg with gap_policy', () => {
const metric = {
id: '2',
type: 'derivative',
field: '1',
gap_policy: 'zero_fill',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.derivative;
expect(fn(metric, metrics, '10s')).toEqual({
derivative: {
buckets_path: '1',
gap_policy: 'zero_fill',
unit: '10s',
},
});
});
test('throws error if type is missing', () => {
const run = () => bucketTransform.derivative({ id: 'test', field: 'cpu.pct' });
expect(run).toThrow(new Error('Metric missing type'));
});
test('throws error if field is missing', () => {
const run = () => bucketTransform.derivative({ id: 'test', type: 'derivative' });
expect(run).toThrow(new Error('Metric missing field'));
});
});
describe('serial_diff', () => {
test('returns serial_diff agg with defaults', () => {
const metric = {
id: '2',
type: 'serial_diff',
field: '1',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.serial_diff;
expect(fn(metric, metrics)).toEqual({
serial_diff: {
buckets_path: '1',
gap_policy: 'skip',
lag: 1,
},
});
});
test('returns serial_diff agg with lag', () => {
const metric = {
id: '2',
type: 'serial_diff',
field: '1',
lag: 10,
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.serial_diff;
expect(fn(metric, metrics)).toEqual({
serial_diff: {
buckets_path: '1',
gap_policy: 'skip',
lag: 10,
},
});
});
test('returns serial_diff agg with gap_policy', () => {
const metric = {
id: '2',
type: 'serial_diff',
field: '1',
gap_policy: 'zero_fill',
};
const metrics = [{ id: '1', type: 'max', field: 'cpu.pct' }, metric];
const fn = bucketTransform.serial_diff;
expect(fn(metric, metrics)).toEqual({
serial_diff: {
buckets_path: '1',
gap_policy: 'zero_fill',
lag: 1,
},
});
});
test('throws error if type is missing', () => {
const run = () => bucketTransform.serial_diff({ id: 'test', field: 'cpu.pct' });
expect(run).toThrow(new Error('Metric missing type'));
});
test('throws error if field is missing', () => {
const run = () => bucketTransform.serial_diff({ id: 'test', type: 'serial_diff' });
expect(run).toThrow(new Error('Metric missing field'));
});
});
describe('cumulative_sum', () => {
test('returns cumulative_sum agg', () => {
const metric = { id: '2', type: 'cumulative_sum', field: '1' };
const metrics = [{ id: '1', type: 'sum', field: 'cpu.pct' }, metric];
const fn = bucketTransform.cumulative_sum;
expect(fn(metric, metrics, '10s')).toEqual({
cumulative_sum: { buckets_path: '1' },
});
});
test('throws error if type is missing', () => {
const run = () => bucketTransform.cumulative_sum({ id: 'test', field: 'cpu.pct' });
expect(run).toThrow(new Error('Metric missing type'));
});
test('throws error if field is missing', () => {
const run = () => bucketTransform.cumulative_sum({ id: 'test', type: 'cumulative_sum' });
expect(run).toThrow(new Error('Metric missing field'));
});
});
describe('calculation', () => {
test('returns calculation(bucket_script)', () => {
const metric = {
id: '2',
type: 'calculation',
script: 'params.idle != null ? 1 - params.idle : 0',
variables: [{ name: 'idle', field: '1' }],
};
const metrics = [{ id: '1', type: 'avg', field: 'cpu.idle.pct' }, metric];
const fn = bucketTransform.calculation;
expect(fn(metric, metrics, '10s')).toEqual({
bucket_script: {
buckets_path: {
idle: '1',
},
gap_policy: 'skip',
script: {
source: 'params.idle != null ? 1 - params.idle : 0',
lang: 'painless',
params: {
_interval: 10000,
},
},
},
});
});
test('throws error if variables is missing', () => {
const run = () =>
bucketTransform.calculation({
id: 'test',
type: 'calculation',
script: 'params.idle != null ? 1 - params.idle : null',
});
expect(run).toThrow(new Error('Metric missing variables'));
});
test('throws error if script is missing', () => {
const run = () =>
bucketTransform.calculation({
id: 'test',
type: 'calculation',
variables: [{ field: '1', name: 'idle' }],
});
expect(run).toThrow(new Error('Metric missing script'));
});
});
describe('positive_only', () => {
test('returns bucket_script', () => {
const metric = {
id: '2',
type: 'positive_only',
field: '1',
};
const metrics = [{ id: '1', type: 'avg', field: 'cpu.idle.pct' }, metric];
const fn = bucketTransform.positive_only;
expect(fn(metric, metrics, '10s')).toEqual({
bucket_script: {
buckets_path: {
value: '1',
},
gap_policy: 'skip',
script: {
source: 'params.value > 0.0 ? params.value : 0.0',
lang: 'painless',
},
},
});
});
});
});
});

View file

@ -17,16 +17,15 @@
* under the License.
*/
import { expect } from 'chai';
import { getAggValue } from '../../helpers/get_agg_value';
import { getAggValue } from './get_agg_value';
function testAgg(row, metric, expected) {
let name = metric.type;
if (metric.mode) name += `(${metric.mode})`;
if (metric.percent) name += `(${metric.percent})`;
it(`it should return ${name}(${expected})`, () => {
test(`it should return ${name}(${expected})`, () => {
const value = getAggValue(row, metric);
expect(value).to.eql(expected);
expect(value).toEqual(expected);
});
}

View file

@ -17,8 +17,7 @@
* under the License.
*/
import { expect } from 'chai';
import { getBucketSize } from '../../helpers/get_bucket_size';
import { getBucketSize } from './get_bucket_size';
describe('getBucketSize', () => {
const req = {
@ -30,39 +29,39 @@ describe('getBucketSize', () => {
},
};
it('returns auto calculated buckets', () => {
test('returns auto calculated buckets', () => {
const result = getBucketSize(req, 'auto');
expect(result).to.have.property('bucketSize', 30);
expect(result).to.have.property('intervalString', '30s');
expect(result).toHaveProperty('bucketSize', 30);
expect(result).toHaveProperty('intervalString', '30s');
});
it('returns overridden buckets (1s)', () => {
test('returns overridden buckets (1s)', () => {
const result = getBucketSize(req, '1s');
expect(result).to.have.property('bucketSize', 1);
expect(result).to.have.property('intervalString', '1s');
expect(result).toHaveProperty('bucketSize', 1);
expect(result).toHaveProperty('intervalString', '1s');
});
it('returns overridden buckets (10m)', () => {
test('returns overridden buckets (10m)', () => {
const result = getBucketSize(req, '10m');
expect(result).to.have.property('bucketSize', 600);
expect(result).to.have.property('intervalString', '10m');
expect(result).toHaveProperty('bucketSize', 600);
expect(result).toHaveProperty('intervalString', '10m');
});
it('returns overridden buckets (1d)', () => {
test('returns overridden buckets (1d)', () => {
const result = getBucketSize(req, '1d');
expect(result).to.have.property('bucketSize', 86400);
expect(result).to.have.property('intervalString', '1d');
expect(result).toHaveProperty('bucketSize', 86400);
expect(result).toHaveProperty('intervalString', '1d');
});
it('returns overridden buckets (>=2d)', () => {
test('returns overridden buckets (>=2d)', () => {
const result = getBucketSize(req, '>=2d');
expect(result).to.have.property('bucketSize', 86400 * 2);
expect(result).to.have.property('intervalString', '2d');
expect(result).toHaveProperty('bucketSize', 86400 * 2);
expect(result).toHaveProperty('intervalString', '2d');
});
it('returns overridden buckets (>=10s)', () => {
test('returns overridden buckets (>=10s)', () => {
const result = getBucketSize(req, '>=10s');
expect(result).to.have.property('bucketSize', 30);
expect(result).to.have.property('intervalString', '30s');
expect(result).toHaveProperty('bucketSize', 30);
expect(result).toHaveProperty('intervalString', '30s');
});
});

View file

@ -17,8 +17,7 @@
* under the License.
*/
import { expect } from 'chai';
import { getBucketsPath } from '../../helpers/get_buckets_path';
import { getBucketsPath } from './get_buckets_path';
describe('getBucketsPath', () => {
const metrics = [
@ -33,43 +32,43 @@ describe('getBucketsPath', () => {
{ id: 9, type: 'max' },
];
it('return path for derivative', () => {
expect(getBucketsPath(1, metrics)).to.equal('1[normalized_value]');
test('return path for derivative', () => {
expect(getBucketsPath(1, metrics)).toEqual('1[normalized_value]');
});
it('return path for percentile(50)', () => {
expect(getBucketsPath(2, metrics)).to.equal('2[50.0]');
test('return path for percentile(50)', () => {
expect(getBucketsPath(2, metrics)).toEqual('2[50.0]');
});
it('return path for percentile(20.0)', () => {
expect(getBucketsPath(3, metrics)).to.equal('3[20.0]');
test('return path for percentile(20.0)', () => {
expect(getBucketsPath(3, metrics)).toEqual('3[20.0]');
});
it('return path for percentile(10.0) with alt id', () => {
expect(getBucketsPath('3[10.0]', metrics)).to.equal('3[10.0]');
test('return path for percentile(10.0) with alt id', () => {
expect(getBucketsPath('3[10.0]', metrics)).toEqual('3[10.0]');
});
it('return path for std_deviation(raw)', () => {
expect(getBucketsPath(4, metrics)).to.equal('4[std_deviation]');
test('return path for std_deviation(raw)', () => {
expect(getBucketsPath(4, metrics)).toEqual('4[std_deviation]');
});
it('return path for std_deviation(upper)', () => {
expect(getBucketsPath(5, metrics)).to.equal('5[std_upper]');
test('return path for std_deviation(upper)', () => {
expect(getBucketsPath(5, metrics)).toEqual('5[std_upper]');
});
it('return path for std_deviation(lower)', () => {
expect(getBucketsPath(6, metrics)).to.equal('6[std_lower]');
test('return path for std_deviation(lower)', () => {
expect(getBucketsPath(6, metrics)).toEqual('6[std_lower]');
});
it('return path for sum_of_squares', () => {
expect(getBucketsPath(7, metrics)).to.equal('7[sum_of_squares]');
test('return path for sum_of_squares', () => {
expect(getBucketsPath(7, metrics)).toEqual('7[sum_of_squares]');
});
it('return path for variance', () => {
expect(getBucketsPath(8, metrics)).to.equal('8[variance]');
test('return path for variance', () => {
expect(getBucketsPath(8, metrics)).toEqual('8[variance]');
});
it('return path for basic metric', () => {
expect(getBucketsPath(9, metrics)).to.equal('9');
test('return path for basic metric', () => {
expect(getBucketsPath(9, metrics)).toEqual('9');
});
});

View file

@ -17,44 +17,43 @@
* under the License.
*/
import { expect } from 'chai';
import { getDefaultDecoration } from '../../helpers/get_default_decoration';
import { getDefaultDecoration } from './get_default_decoration';
describe('getDefaultDecoration', () => {
describe('stack option', () => {
it('should set a stack option to none', () => {
test('should set a stack option to none', () => {
const series = {
id: 'test_id',
stacked: 'none',
};
expect(getDefaultDecoration(series)).to.have.property('stack', 'none');
expect(getDefaultDecoration(series)).toHaveProperty('stack', 'none');
});
it('should set a stack option to stacked/percent', () => {
test('should set a stack option to stacked/percent', () => {
const series = {
stacked: 'stacked',
id: 'test_id',
};
expect(getDefaultDecoration(series)).to.have.property('stack', 'stacked');
expect(getDefaultDecoration(series)).toHaveProperty('stack', 'stacked');
series.stacked = 'percent';
expect(getDefaultDecoration(series)).to.have.property('stack', 'percent');
expect(getDefaultDecoration(series)).toHaveProperty('stack', 'percent');
});
it('should set a stack option to stacked_within_series', () => {
test('should set a stack option to stacked_within_series', () => {
const series = {
stacked: 'stacked_within_series',
id: 'test_id',
};
expect(getDefaultDecoration(series)).to.have.property('stack', 'stacked_within_series');
expect(getDefaultDecoration(series)).toHaveProperty('stack', 'stacked_within_series');
});
});
describe('lines', () => {
it('return decoration for lines', () => {
test('return decoration for lines', () => {
const series = {
point_size: 10,
chart_type: 'line',
@ -62,29 +61,29 @@ describe('getDefaultDecoration', () => {
fill: 1,
};
const result = getDefaultDecoration(series);
expect(result.lines).to.have.property('show', true);
expect(result.lines).to.have.property('fill', 1);
expect(result.lines).to.have.property('lineWidth', 10);
expect(result.points).to.have.property('show', true);
expect(result.points).to.have.property('radius', 1);
expect(result.points).to.have.property('lineWidth', 10);
expect(result.bars).to.have.property('show', false);
expect(result.bars).to.have.property('fill', 1);
expect(result.bars).to.have.property('lineWidth', 10);
expect(result.lines).toHaveProperty('show', true);
expect(result.lines).toHaveProperty('fill', 1);
expect(result.lines).toHaveProperty('lineWidth', 10);
expect(result.points).toHaveProperty('show', true);
expect(result.points).toHaveProperty('radius', 1);
expect(result.points).toHaveProperty('lineWidth', 10);
expect(result.bars).toHaveProperty('show', false);
expect(result.bars).toHaveProperty('fill', 1);
expect(result.bars).toHaveProperty('lineWidth', 10);
});
it('return decoration for lines without points', () => {
test('return decoration for lines without points', () => {
const series = {
chart_type: 'line',
line_width: 10,
fill: 1,
};
const result = getDefaultDecoration(series);
expect(result.points).to.have.property('show', true);
expect(result.points).to.have.property('lineWidth', 10);
expect(result.points).toHaveProperty('show', true);
expect(result.points).toHaveProperty('lineWidth', 10);
});
it('return decoration for lines with points set to zero (off)', () => {
test('return decoration for lines with points set to zero (off)', () => {
const series = {
chart_type: 'line',
line_width: 10,
@ -92,32 +91,32 @@ describe('getDefaultDecoration', () => {
point_size: 0,
};
const result = getDefaultDecoration(series);
expect(result.points).to.have.property('show', false);
expect(result.points).toHaveProperty('show', false);
});
it('return decoration for lines (off)', () => {
test('return decoration for lines (off)', () => {
const series = {
chart_type: 'line',
line_width: 0,
};
const result = getDefaultDecoration(series);
expect(result.lines).to.have.property('show', false);
expect(result.lines).toHaveProperty('show', false);
});
});
describe('bars', () => {
it('return decoration for bars', () => {
test('return decoration for bars', () => {
const series = {
chart_type: 'bar',
line_width: 10,
fill: 1,
};
const result = getDefaultDecoration(series);
expect(result.lines).to.have.property('show', false);
expect(result.points).to.have.property('show', false);
expect(result.bars).to.have.property('show', true);
expect(result.bars).to.have.property('fill', 1);
expect(result.bars).to.have.property('lineWidth', 10);
expect(result.lines).toHaveProperty('show', false);
expect(result.points).toHaveProperty('show', false);
expect(result.bars).toHaveProperty('show', true);
expect(result.bars).toHaveProperty('fill', 1);
expect(result.bars).toHaveProperty('lineWidth', 10);
});
});
});

View file

@ -17,11 +17,10 @@
* under the License.
*/
import { expect } from 'chai';
import { getEsShardTimeout } from '../../helpers/get_es_shard_timeout';
import { getEsShardTimeout } from './get_es_shard_timeout';
describe('getEsShardTimeout', () => {
it('should return the elasticsearch.shardTimeout', async () => {
test('should return the elasticsearch.shardTimeout', async () => {
const req = {
getEsShardTimeout: async () => {
return 12345;
@ -30,6 +29,6 @@ describe('getEsShardTimeout', () => {
const timeout = await getEsShardTimeout(req);
expect(timeout).to.equal(12345);
expect(timeout).toEqual(12345);
});
});

View file

@ -17,26 +17,25 @@
* under the License.
*/
import { expect } from 'chai';
import { getLastMetric } from '../../helpers/get_last_metric';
import { getLastMetric } from './get_last_metric';
describe('getLastMetric(series)', () => {
it('returns the last metric', () => {
test('returns the last metric', () => {
const series = {
metrics: [
{ id: 1, type: 'avg' },
{ id: 2, type: 'moving_average' },
],
};
expect(getLastMetric(series)).to.eql({ id: 2, type: 'moving_average' });
expect(getLastMetric(series)).toEqual({ id: 2, type: 'moving_average' });
});
it('returns the last metric that not a series_agg', () => {
test('returns the last metric that not a series_agg', () => {
const series = {
metrics: [
{ id: 1, type: 'avg' },
{ id: 2, type: 'series_agg' },
],
};
expect(getLastMetric(series)).to.eql({ id: 1, type: 'avg' });
expect(getLastMetric(series)).toEqual({ id: 1, type: 'avg' });
});
});

View file

@ -17,8 +17,7 @@
* under the License.
*/
import { expect } from 'chai';
import { getSiblingAggValue } from '../../helpers/get_sibling_agg_value';
import { getSiblingAggValue } from './get_sibling_agg_value';
describe('getSiblingAggValue', () => {
const row = {
@ -32,23 +31,23 @@ describe('getSiblingAggValue', () => {
},
};
it('returns the value for std_deviation_bounds.upper', () => {
test('returns the value for std_deviation_bounds.upper', () => {
const metric = { id: 'test', type: 'std_deviation_bucket', mode: 'upper' };
expect(getSiblingAggValue(row, metric)).to.equal(2);
expect(getSiblingAggValue(row, metric)).toEqual(2);
});
it('returns the value for std_deviation_bounds.lower', () => {
test('returns the value for std_deviation_bounds.lower', () => {
const metric = { id: 'test', type: 'std_deviation_bucket', mode: 'lower' };
expect(getSiblingAggValue(row, metric)).to.equal(1);
expect(getSiblingAggValue(row, metric)).toEqual(1);
});
it('returns the value for std_deviation', () => {
test('returns the value for std_deviation', () => {
const metric = { id: 'test', type: 'std_deviation_bucket', mode: 'raw' };
expect(getSiblingAggValue(row, metric)).to.equal(1.5);
expect(getSiblingAggValue(row, metric)).toEqual(1.5);
});
it('returns the value for basic (max)', () => {
test('returns the value for basic (max)', () => {
const metric = { id: 'test', type: 'max_bucket' };
expect(getSiblingAggValue(row, metric)).to.equal(3);
expect(getSiblingAggValue(row, metric)).toEqual(3);
});
});

View file

@ -17,11 +17,10 @@
* under the License.
*/
import { expect } from 'chai';
import { getSplits } from '../../helpers/get_splits';
import { getSplits } from './get_splits';
describe('getSplits(resp, panel, series)', () => {
it('should return a splits for everything/filter group bys', () => {
test('should return a splits for everything/filter group bys', () => {
const resp = {
aggregations: {
SERIES: {
@ -41,7 +40,7 @@ describe('getSplits(resp, panel, series)', () => {
{ id: 'SIBAGG', type: 'avg_bucket', field: 'AVG' },
],
};
expect(getSplits(resp, panel, series)).to.eql([
expect(getSplits(resp, panel, series)).toEqual([
{
id: 'SERIES',
label: 'Overall Average of Average of cpu',
@ -53,7 +52,7 @@ describe('getSplits(resp, panel, series)', () => {
]);
});
it('should return a splits for terms group bys for top_n', () => {
test('should return a splits for terms group bys for top_n', () => {
const resp = {
aggregations: {
SERIES: {
@ -85,7 +84,7 @@ describe('getSplits(resp, panel, series)', () => {
],
};
const panel = { type: 'top_n' };
expect(getSplits(resp, panel, series)).to.eql([
expect(getSplits(resp, panel, series)).toEqual([
{
id: 'SERIES:example-01',
key: 'example-01',
@ -107,7 +106,7 @@ describe('getSplits(resp, panel, series)', () => {
]);
});
it('should return a splits for terms group bys', () => {
test('should return a splits for terms group bys', () => {
const resp = {
aggregations: {
SERIES: {
@ -139,7 +138,7 @@ describe('getSplits(resp, panel, series)', () => {
],
};
const panel = { type: 'timeseries' };
expect(getSplits(resp, panel, series)).to.eql([
expect(getSplits(resp, panel, series)).toEqual([
{
id: 'SERIES:example-01',
key: 'example-01',
@ -161,7 +160,7 @@ describe('getSplits(resp, panel, series)', () => {
]);
});
it('should return a splits for filters group bys', () => {
test('should return a splits for filters group bys', () => {
const resp = {
aggregations: {
SERIES: {
@ -188,7 +187,7 @@ describe('getSplits(resp, panel, series)', () => {
metrics: [{ id: 'COUNT', type: 'count' }],
};
const panel = { type: 'timeseries' };
expect(getSplits(resp, panel, series)).to.eql([
expect(getSplits(resp, panel, series)).toEqual([
{
id: 'SERIES:filter-1',
key: 'filter-1',

View file

@ -17,12 +17,11 @@
* under the License.
*/
import { expect } from 'chai';
import { getTimerange } from '../../helpers/get_timerange';
import { getTimerange } from './get_timerange';
import moment from 'moment';
describe('getTimerange(req)', () => {
it('should return a moment object for to and from', () => {
test('should return a moment object for to and from', () => {
const req = {
payload: {
timerange: {
@ -32,9 +31,9 @@ describe('getTimerange(req)', () => {
},
};
const { from, to } = getTimerange(req);
expect(moment.isMoment(from)).to.equal(true);
expect(moment.isMoment(to)).to.equal(true);
expect(moment.utc('2017-01-01T00:00:00Z').isSame(from)).to.equal(true);
expect(moment.utc('2017-01-01T01:00:00Z').isSame(to)).to.equal(true);
expect(moment.isMoment(from)).toEqual(true);
expect(moment.isMoment(to)).toEqual(true);
expect(moment.utc('2017-01-01T00:00:00Z').isSame(from)).toEqual(true);
expect(moment.utc('2017-01-01T01:00:00Z').isSame(to)).toEqual(true);
});
});

View file

@ -17,40 +17,39 @@
* under the License.
*/
import { mapBucket } from '../../helpers/map_bucket';
import { expect } from 'chai';
import { mapBucket } from './map_bucket';
describe('mapBucket(metric)', () => {
it('returns bucket key and value for basic metric', () => {
test('returns bucket key and value for basic metric', () => {
const metric = { id: 'AVG', type: 'avg' };
const bucket = {
key: 1234,
AVG: { value: 1 },
};
expect(mapBucket(metric)(bucket)).to.eql([1234, 1]);
expect(mapBucket(metric)(bucket)).toEqual([1234, 1]);
});
it('returns bucket key and value for std_deviation', () => {
test('returns bucket key and value for std_deviation', () => {
const metric = { id: 'STDDEV', type: 'std_deviation' };
const bucket = {
key: 1234,
STDDEV: { std_deviation: 1 },
};
expect(mapBucket(metric)(bucket)).to.eql([1234, 1]);
expect(mapBucket(metric)(bucket)).toEqual([1234, 1]);
});
it('returns bucket key and value for percentiles', () => {
test('returns bucket key and value for percentiles', () => {
const metric = { id: 'PCT', type: 'percentile', percent: 50 };
const bucket = {
key: 1234,
PCT: { values: { '50.0': 1 } },
};
expect(mapBucket(metric)(bucket)).to.eql([1234, 1]);
expect(mapBucket(metric)(bucket)).toEqual([1234, 1]);
});
it('returns bucket key and value for derivative', () => {
test('returns bucket key and value for derivative', () => {
const metric = { id: 'DERV', type: 'derivative', field: 'io', unit: '1s' };
const bucket = {
key: 1234,
DERV: { value: 100, normalized_value: 1 },
};
expect(mapBucket(metric)(bucket)).to.eql([1234, 1]);
expect(mapBucket(metric)(bucket)).toEqual([1234, 1]);
});
});

View file

@ -17,41 +17,40 @@
* under the License.
*/
import { expect } from 'chai';
import { parseSettings } from '../../helpers/parse_settings';
import { parseSettings } from './parse_settings';
describe('parseSettings', () => {
it('returns the true for "true"', () => {
test('returns the true for "true"', () => {
const settings = 'pad=true';
expect(parseSettings(settings)).to.eql({
expect(parseSettings(settings)).toEqual({
pad: true,
});
});
it('returns the false for "false"', () => {
test('returns the false for "false"', () => {
const settings = 'pad=false';
expect(parseSettings(settings)).to.eql({
expect(parseSettings(settings)).toEqual({
pad: false,
});
});
it('returns the true for 1', () => {
test('returns the true for 1', () => {
const settings = 'pad=1';
expect(parseSettings(settings)).to.eql({
expect(parseSettings(settings)).toEqual({
pad: true,
});
});
it('returns the false for 0', () => {
test('returns the false for 0', () => {
const settings = 'pad=0';
expect(parseSettings(settings)).to.eql({
expect(parseSettings(settings)).toEqual({
pad: false,
});
});
it('returns the settings as an object', () => {
test('returns the settings as an object', () => {
const settings = 'alpha=0.9 beta=0.4 gamma=0.2 period=5 pad=false type=add';
expect(parseSettings(settings)).to.eql({
expect(parseSettings(settings)).toEqual({
alpha: 0.9,
beta: 0.4,
gamma: 0.2,

View file

@ -17,12 +17,11 @@
* under the License.
*/
import { expect } from 'chai';
import moment from 'moment';
import { offsetTime } from '../offset_time';
import { offsetTime } from './offset_time';
describe('offsetTime(req, by)', () => {
it('should return a moment object for to and from', () => {
test('should return a moment object for to and from', () => {
const req = {
payload: {
timerange: {
@ -32,13 +31,13 @@ describe('offsetTime(req, by)', () => {
},
};
const { from, to } = offsetTime(req, '');
expect(moment.isMoment(from)).to.equal(true);
expect(moment.isMoment(to)).to.equal(true);
expect(moment.utc('2017-01-01T00:00:00Z').isSame(from)).to.equal(true);
expect(moment.utc('2017-01-01T01:00:00Z').isSame(to)).to.equal(true);
expect(moment.isMoment(from)).toBeTruthy();
expect(moment.isMoment(to)).toBeTruthy();
expect(moment.utc('2017-01-01T00:00:00Z').isSame(from)).toBeTruthy();
expect(moment.utc('2017-01-01T01:00:00Z').isSame(to)).toBeTruthy();
});
it('should return a moment object for to and from offset by 1 hour', () => {
test('should return a moment object for to and from offset by 1 hour', () => {
const req = {
payload: {
timerange: {
@ -48,23 +47,23 @@ describe('offsetTime(req, by)', () => {
},
};
const { from, to } = offsetTime(req, '1h');
expect(moment.isMoment(from)).to.equal(true);
expect(moment.isMoment(to)).to.equal(true);
expect(moment.isMoment(from)).toBeTruthy();
expect(moment.isMoment(to)).toBeTruthy();
expect(
moment
.utc('2017-01-01T00:00:00Z')
.subtract(1, 'h')
.isSame(from)
).to.equal(true);
).toBeTruthy();
expect(
moment
.utc('2017-01-01T01:00:00Z')
.subtract(1, 'h')
.isSame(to)
).to.equal(true);
).toBeTruthy();
});
it('should return a moment object for to and from offset by -2 minute', () => {
test('should return a moment object for to and from offset by -2 minute', () => {
const req = {
payload: {
timerange: {
@ -74,13 +73,13 @@ describe('offsetTime(req, by)', () => {
},
};
const { from, to } = offsetTime(req, '-2m');
expect(moment.isMoment(from)).to.equal(true);
expect(moment.isMoment(to)).to.equal(true);
expect(moment.utc('2017-01-10T01:02:00Z').isSame(from)).to.equal(true);
expect(moment.utc('2017-01-10T02:02:00Z').isSame(to)).to.equal(true);
expect(moment.isMoment(from)).toBeTruthy();
expect(moment.isMoment(to)).toBeTruthy();
expect(moment.utc('2017-01-10T01:02:00Z').isSame(from)).toBeTruthy();
expect(moment.utc('2017-01-10T02:02:00Z').isSame(to)).toBeTruthy();
});
it('should work when prefixing positive offsets with the plus sign', () => {
test('should work when prefixing positive offsets with the plus sign', () => {
const req = {
payload: {
timerange: {
@ -92,7 +91,7 @@ describe('offsetTime(req, by)', () => {
const { from: fromSigned, to: toSigned } = offsetTime(req, '+1m');
const { from, to } = offsetTime(req, '1m');
expect(fromSigned.isSame(from)).to.equal(true);
expect(toSigned.isSame(to)).to.equal(true);
expect(fromSigned.isSame(from)).toBeTruthy();
expect(toSigned.isSame(to)).toBeTruthy();
});
});

View file

@ -17,10 +17,8 @@
* under the License.
*/
import { expect } from 'chai';
import sinon from 'sinon';
import { DefaultSearchCapabilities } from '../../../../search_strategies/default_search_capabilities';
import { dateHistogram } from '../date_histogram';
import { DefaultSearchCapabilities } from '../../../search_strategies/default_search_capabilities';
import { dateHistogram } from './date_histogram';
describe('dateHistogram(req, panel, series)', () => {
let panel;
@ -54,18 +52,18 @@ describe('dateHistogram(req, panel, series)', () => {
capabilities = new DefaultSearchCapabilities(req);
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
dateHistogram(req, panel, series, config, indexPatternObject, capabilities)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns valid date histogram', () => {
test('returns valid date histogram', () => {
const next = doc => doc;
const doc = dateHistogram(req, panel, series, config, indexPatternObject, capabilities)(next)(
{}
);
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {
@ -93,13 +91,13 @@ describe('dateHistogram(req, panel, series)', () => {
});
});
it('returns valid date histogram (offset by 1h)', () => {
test('returns valid date histogram (offset by 1h)', () => {
series.offset_time = '1h';
const next = doc => doc;
const doc = dateHistogram(req, panel, series, config, indexPatternObject, capabilities)(next)(
{}
);
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {
@ -127,7 +125,7 @@ describe('dateHistogram(req, panel, series)', () => {
});
});
it('returns valid date histogram with overridden index pattern', () => {
test('returns valid date histogram with overridden index pattern', () => {
series.override_index_pattern = 1;
series.series_index_pattern = '*';
series.series_time_field = 'timestamp';
@ -136,7 +134,7 @@ describe('dateHistogram(req, panel, series)', () => {
const doc = dateHistogram(req, panel, series, config, indexPatternObject, capabilities)(next)(
{}
);
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {
@ -165,7 +163,7 @@ describe('dateHistogram(req, panel, series)', () => {
});
describe('dateHistogram for entire time range mode', () => {
it('should ignore entire range mode for timeseries', () => {
test('should ignore entire range mode for timeseries', () => {
panel.time_range_mode = 'entire_time_range';
panel.type = 'timeseries';
@ -174,18 +172,18 @@ describe('dateHistogram(req, panel, series)', () => {
{}
);
expect(doc.aggs.test.aggs.timeseries.auto_date_histogram).to.eql(undefined);
expect(doc.aggs.test.aggs.timeseries.date_histogram).to.exist;
expect(doc.aggs.test.aggs.timeseries.auto_date_histogram).toBeUndefined();
expect(doc.aggs.test.aggs.timeseries.date_histogram).toBeDefined();
});
it('should returns valid date histogram for entire range mode', () => {
test('should returns valid date histogram for entire range mode', () => {
panel.time_range_mode = 'entire_time_range';
const next = doc => doc;
const doc = dateHistogram(req, panel, series, config, indexPatternObject, capabilities)(next)(
{}
);
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { ratios } from '../filter_ratios';
import { expect } from 'chai';
import sinon from 'sinon';
import { ratios } from './filter_ratios';
describe('ratios(req, panel, series)', () => {
let panel;
@ -55,16 +53,16 @@ describe('ratios(req, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
ratios(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns filter ratio aggs', () => {
test('returns filter ratio aggs', () => {
const next = doc => doc;
const doc = ratios(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {
@ -119,11 +117,11 @@ describe('ratios(req, panel, series)', () => {
});
});
it('returns empty object when field is not set', () => {
test('returns empty object when field is not set', () => {
delete series.metrics[0].field;
const next = doc => doc;
const doc = ratios(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { metricBuckets } from '../metric_buckets';
import { expect } from 'chai';
import sinon from 'sinon';
import { metricBuckets } from './metric_buckets';
describe('metricBuckets(req, panel, series)', () => {
let panel;
@ -63,16 +61,16 @@ describe('metricBuckets(req, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
metricBuckets(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns metric aggs', () => {
test('returns metric aggs', () => {
const next = doc => doc;
const doc = metricBuckets(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { query } from '../query';
import { expect } from 'chai';
import sinon from 'sinon';
import { query } from './query';
describe('query(req, panel, series)', () => {
let panel;
@ -47,16 +45,16 @@ describe('query(req, panel, series)', () => {
series = { id: 'test' };
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
query(req, panel, series, config)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns doc with query for timerange', () => {
test('returns doc with query for timerange', () => {
const next = doc => doc;
const doc = query(req, panel, series, config)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {
@ -79,11 +77,11 @@ describe('query(req, panel, series)', () => {
});
});
it('returns doc with query for timerange (offset by 1h)', () => {
test('returns doc with query for timerange (offset by 1h)', () => {
series.offset_time = '1h';
const next = doc => doc;
const doc = query(req, panel, series, config)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {
@ -106,7 +104,7 @@ describe('query(req, panel, series)', () => {
});
});
it('returns doc with global query', () => {
test('returns doc with global query', () => {
req.payload.filters = [
{
bool: {
@ -122,7 +120,7 @@ describe('query(req, panel, series)', () => {
];
const next = doc => doc;
const doc = query(req, panel, series, config)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {
@ -157,11 +155,11 @@ describe('query(req, panel, series)', () => {
});
});
it('returns doc with series filter', () => {
test('returns doc with series filter', () => {
series.filter = { query: 'host:web-server', language: 'lucene' };
const next = doc => doc;
const doc = query(req, panel, series, config)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {
@ -198,7 +196,7 @@ describe('query(req, panel, series)', () => {
},
});
});
it('returns doc with panel filter and global', () => {
test('returns doc with panel filter and global', () => {
req.payload.filters = [
{
bool: {
@ -215,7 +213,7 @@ describe('query(req, panel, series)', () => {
panel.filter = { query: 'host:web-server', language: 'lucene' };
const next = doc => doc;
const doc = query(req, panel, series, config)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {
@ -265,7 +263,7 @@ describe('query(req, panel, series)', () => {
});
});
it('returns doc with panel filter (ignoring globals)', () => {
test('returns doc with panel filter (ignoring globals)', () => {
req.payload.filters = [
{
bool: {
@ -283,7 +281,7 @@ describe('query(req, panel, series)', () => {
panel.ignore_global_filter = true;
const next = doc => doc;
const doc = query(req, panel, series, config)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { siblingBuckets } from '../sibling_buckets';
import { expect } from 'chai';
import sinon from 'sinon';
import { siblingBuckets } from './sibling_buckets';
describe('siblingBuckets(req, panel, series)', () => {
let panel;
@ -57,16 +55,16 @@ describe('siblingBuckets(req, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
siblingBuckets(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns sibling aggs', () => {
test('returns sibling aggs', () => {
const next = doc => doc;
const doc = siblingBuckets(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
aggs: {

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { splitByEverything } from '../split_by_everything';
import { expect } from 'chai';
import sinon from 'sinon';
import { splitByEverything } from './split_by_everything';
describe('splitByEverything(req, panel, series)', () => {
let panel;
@ -39,15 +37,15 @@ describe('splitByEverything(req, panel, series)', () => {
});
it('calls next when finished', () => {
const next = sinon.spy();
const next = jest.fn();
splitByEverything(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns a valid filter with match_all', () => {
const next = doc => doc;
const doc = splitByEverything(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
filter: {
@ -61,9 +59,9 @@ describe('splitByEverything(req, panel, series)', () => {
it('calls next and does not add a filter', () => {
series.split_mode = 'terms';
series.terms_field = 'host';
const next = sinon.spy(doc => doc);
const next = jest.fn(doc => doc);
const doc = splitByEverything(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(doc).to.eql({});
expect(next.mock.calls.length).toEqual(1);
expect(doc).toEqual({});
});
});

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { splitByFilter } from '../split_by_filter';
import { expect } from 'chai';
import sinon from 'sinon';
import { splitByFilter } from './split_by_filter';
describe('splitByFilter(req, panel, series)', () => {
let panel;
@ -42,16 +40,16 @@ describe('splitByFilter(req, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
splitByFilter(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns a valid filter with a query_string', () => {
test('returns a valid filter with a query_string', () => {
const next = doc => doc;
const doc = splitByFilter(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
filter: {
@ -73,11 +71,11 @@ describe('splitByFilter(req, panel, series)', () => {
});
});
it('calls next and does not add a filter', () => {
test('calls next and does not add a filter', () => {
series.split_mode = 'terms';
const next = sinon.spy(doc => doc);
const next = jest.fn(doc => doc);
const doc = splitByFilter(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(doc).to.eql({});
expect(next.mock.calls.length).toEqual(1);
expect(doc).toEqual({});
});
});

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { splitByFilters } from '../split_by_filters';
import { expect } from 'chai';
import sinon from 'sinon';
import { splitByFilters } from './split_by_filters';
describe('splitByFilters(req, panel, series)', () => {
let panel;
@ -58,16 +56,16 @@ describe('splitByFilters(req, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
splitByFilters(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns a valid terms agg', () => {
test('returns a valid terms agg', () => {
const next = doc => doc;
const doc = splitByFilters(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
filters: {
@ -107,11 +105,11 @@ describe('splitByFilters(req, panel, series)', () => {
});
});
it('calls next and does not add a terms agg', () => {
test('calls next and does not add a terms agg', () => {
series.split_mode = 'everything';
const next = sinon.spy(doc => doc);
const next = jest.fn(doc => doc);
const doc = splitByFilters(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(doc).to.eql({});
expect(next.mock.calls.length).toEqual(1);
expect(doc).toEqual({});
});
});

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { splitByTerms } from '../split_by_terms';
import { expect } from 'chai';
import sinon from 'sinon';
import { splitByTerms } from './split_by_terms';
describe('splitByTerms(req, panel, series)', () => {
let panel;
@ -46,16 +44,16 @@ describe('splitByTerms(req, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
splitByTerms(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('returns a valid terms agg', () => {
test('returns a valid terms agg', () => {
const next = doc => doc;
const doc = splitByTerms(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
terms: {
@ -70,12 +68,12 @@ describe('splitByTerms(req, panel, series)', () => {
});
});
it('returns a valid terms agg sort by terms', () => {
test('returns a valid terms agg sort by terms', () => {
const next = doc => doc;
series.terms_order_by = '_key';
series.terms_direction = 'asc';
const doc = splitByTerms(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
terms: {
@ -90,11 +88,11 @@ describe('splitByTerms(req, panel, series)', () => {
});
});
it('returns a valid terms agg with custom sort', () => {
test('returns a valid terms agg with custom sort', () => {
series.terms_order_by = 'avgmetric';
const next = doc => doc;
const doc = splitByTerms(req, panel, series)(next)({});
expect(doc).to.eql({
expect(doc).toEqual({
aggs: {
test: {
terms: {
@ -116,11 +114,11 @@ describe('splitByTerms(req, panel, series)', () => {
});
});
it('calls next and does not add a terms agg', () => {
test('calls next and does not add a terms agg', () => {
series.split_mode = 'everything';
const next = sinon.spy(doc => doc);
const next = jest.fn(doc => doc);
const doc = splitByTerms(req, panel, series)(next)({});
expect(next.calledOnce).to.equal(true);
expect(doc).to.eql({});
expect(next.mock.calls.length).toEqual(1);
expect(doc).toEqual({});
});
});

View file

@ -17,8 +17,7 @@
* under the License.
*/
import { expect } from 'chai';
import { SeriesAgg as seriesAgg } from '../_series_agg';
import { SeriesAgg as seriesAgg } from './_series_agg';
describe('seriesAgg', () => {
const series = [
@ -40,8 +39,8 @@ describe('seriesAgg', () => {
];
describe('basic', () => {
it('returns the series sum', () => {
expect(seriesAgg.sum(series)).to.eql([
test('returns the series sum', () => {
expect(seriesAgg.sum(series)).toEqual([
[
[0, 8],
[1, 4],
@ -50,8 +49,8 @@ describe('seriesAgg', () => {
]);
});
it('returns the series max', () => {
expect(seriesAgg.max(series)).to.eql([
test('returns the series max', () => {
expect(seriesAgg.max(series)).toEqual([
[
[0, 4],
[1, 2],
@ -60,8 +59,8 @@ describe('seriesAgg', () => {
]);
});
it('returns the series min', () => {
expect(seriesAgg.min(series)).to.eql([
test('returns the series min', () => {
expect(seriesAgg.min(series)).toEqual([
[
[0, 2],
[1, 1],
@ -70,8 +69,8 @@ describe('seriesAgg', () => {
]);
});
it('returns the series mean', () => {
expect(seriesAgg.mean(series)).to.eql([
test('returns the series mean', () => {
expect(seriesAgg.mean(series)).toEqual([
[
[0, 8 / 3],
[1, 4 / 3],
@ -82,8 +81,8 @@ describe('seriesAgg', () => {
});
describe('overall', () => {
it('returns the series overall sum', () => {
expect(seriesAgg.overall_sum(series)).to.eql([
test('returns the series overall sum', () => {
expect(seriesAgg.overall_sum(series)).toEqual([
[
[0, 21],
[1, 21],
@ -92,8 +91,8 @@ describe('seriesAgg', () => {
]);
});
it('returns the series overall max', () => {
expect(seriesAgg.overall_max(series)).to.eql([
test('returns the series overall max', () => {
expect(seriesAgg.overall_max(series)).toEqual([
[
[0, 4],
[1, 4],
@ -102,8 +101,8 @@ describe('seriesAgg', () => {
]);
});
it('returns the series overall min', () => {
expect(seriesAgg.overall_min(series)).to.eql([
test('returns the series overall min', () => {
expect(seriesAgg.overall_min(series)).toEqual([
[
[0, 1],
[1, 1],
@ -112,9 +111,9 @@ describe('seriesAgg', () => {
]);
});
it('returns the series overall mean', () => {
test('returns the series overall mean', () => {
const value = (8 + 4 + 9) / 3;
expect(seriesAgg.overall_avg(series)).to.eql([
expect(seriesAgg.overall_avg(series)).toEqual([
[
[0, value],
[1, value],
@ -125,8 +124,8 @@ describe('seriesAgg', () => {
});
describe('cumulative sum', () => {
it('returns the series cumulative sum', () => {
expect(seriesAgg.cumulative_sum(series)).to.eql([
test('returns the series cumulative sum', () => {
expect(seriesAgg.cumulative_sum(series)).toEqual([
[
[0, 8],
[1, 12],

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { percentile } from '../percentile';
import { expect } from 'chai';
import sinon from 'sinon';
import { percentile } from './percentile';
describe('percentile(resp, panel, series)', () => {
let panel;
@ -82,72 +80,72 @@ describe('percentile(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
percentile(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('creates a series', () => {
test('creates a series', () => {
const next = results => results;
const results = percentile(resp, panel, series)(next)([]);
expect(results).to.have.length(3);
expect(results).toHaveLength(3);
expect(results[0]).to.have.property('id', 'test:10-90');
expect(results[0]).to.have.property('color', 'rgb(255, 0, 0)');
expect(results[0]).to.have.property('fillBetween', 'test:10-90:90');
expect(results[0]).to.have.property('label', 'Percentile of cpu (10)');
expect(results[0]).to.have.property('legend', false);
expect(results[0]).to.have.property('lines');
expect(results[0].lines).to.eql({
expect(results[0]).toHaveProperty('id', 'test:10-90');
expect(results[0]).toHaveProperty('color', 'rgb(255, 0, 0)');
expect(results[0]).toHaveProperty('fillBetween', 'test:10-90:90');
expect(results[0]).toHaveProperty('label', 'Percentile of cpu (10)');
expect(results[0]).toHaveProperty('legend', false);
expect(results[0]).toHaveProperty('lines');
expect(results[0].lines).toEqual({
fill: 0.2,
lineWidth: 0,
show: true,
});
expect(results[0]).to.have.property('points');
expect(results[0].points).to.eql({ show: false });
expect(results[0].data).to.eql([
expect(results[0]).toHaveProperty('points');
expect(results[0].points).toEqual({ show: false });
expect(results[0].data).toEqual([
[1, 1],
[2, 1.2],
]);
expect(results[1]).to.have.property('id', 'test:10-90:90');
expect(results[1]).to.have.property('color', 'rgb(255, 0, 0)');
expect(results[1]).to.have.property('label', 'Percentile of cpu (10)');
expect(results[1]).to.have.property('legend', false);
expect(results[1]).to.have.property('lines');
expect(results[1].lines).to.eql({
expect(results[1]).toHaveProperty('id', 'test:10-90:90');
expect(results[1]).toHaveProperty('color', 'rgb(255, 0, 0)');
expect(results[1]).toHaveProperty('label', 'Percentile of cpu (10)');
expect(results[1]).toHaveProperty('legend', false);
expect(results[1]).toHaveProperty('lines');
expect(results[1].lines).toEqual({
fill: false,
lineWidth: 0,
show: true,
});
expect(results[1]).to.have.property('points');
expect(results[1].points).to.eql({ show: false });
expect(results[1].data).to.eql([
expect(results[1]).toHaveProperty('points');
expect(results[1].points).toEqual({ show: false });
expect(results[1].data).toEqual([
[1, 5],
[2, 5.3],
]);
expect(results[2]).to.have.property('id', 'test:50');
expect(results[2]).to.have.property('color', 'rgb(255, 0, 0)');
expect(results[2]).to.have.property('label', 'Percentile of cpu (50)');
expect(results[2]).to.have.property('stack', false);
expect(results[2]).to.have.property('lines');
expect(results[2].lines).to.eql({
expect(results[2]).toHaveProperty('id', 'test:50');
expect(results[2]).toHaveProperty('color', 'rgb(255, 0, 0)');
expect(results[2]).toHaveProperty('label', 'Percentile of cpu (50)');
expect(results[2]).toHaveProperty('stack', false);
expect(results[2]).toHaveProperty('lines');
expect(results[2].lines).toEqual({
fill: 0,
lineWidth: 1,
show: true,
steps: false,
});
expect(results[2]).to.have.property('bars');
expect(results[2].bars).to.eql({
expect(results[2]).toHaveProperty('bars');
expect(results[2].bars).toEqual({
fill: 0,
lineWidth: 1,
show: false,
});
expect(results[2]).to.have.property('points');
expect(results[2].points).to.eql({ show: true, lineWidth: 1, radius: 1 });
expect(results[2].data).to.eql([
expect(results[2]).toHaveProperty('points');
expect(results[2].points).toEqual({ show: true, lineWidth: 1, radius: 1 });
expect(results[2].data).toEqual([
[1, 2.5],
[2, 2.7],
]);

View file

@ -17,10 +17,8 @@
* under the License.
*/
import { seriesAgg } from '../series_agg';
import { stdMetric } from '../std_metric';
import { expect } from 'chai';
import sinon from 'sinon';
import { seriesAgg } from './series_agg';
import { stdMetric } from './std_metric';
describe('seriesAgg(resp, panel, series)', () => {
let panel;
@ -93,18 +91,18 @@ describe('seriesAgg(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
seriesAgg(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('creates a series', () => {
test('creates a series', () => {
const next = seriesAgg(resp, panel, series)(results => results);
const results = stdMetric(resp, panel, series)(next)([]);
expect(results).to.have.length(1);
expect(results).toHaveLength(1);
expect(results[0]).to.eql({
expect(results[0]).toEqual({
id: 'test',
color: '#F00',
label: 'Total CPU',

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { stdDeviationBands } from '../std_deviation_bands';
import { expect } from 'chai';
import sinon from 'sinon';
import { stdDeviationBands } from './std_deviation_bands';
describe('stdDeviationBands(resp, panel, series)', () => {
let panel;
@ -79,18 +77,18 @@ describe('stdDeviationBands(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
stdDeviationBands(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('creates a series', () => {
test('creates a series', () => {
const next = results => results;
const results = stdDeviationBands(resp, panel, series)(next)([]);
expect(results).to.have.length(2);
expect(results).toHaveLength(2);
expect(results[0]).to.eql({
expect(results[0]).toEqual({
id: 'test:upper',
label: 'Std. Deviation of cpu',
color: 'rgb(255, 0, 0)',
@ -103,7 +101,7 @@ describe('stdDeviationBands(resp, panel, series)', () => {
],
});
expect(results[1]).to.eql({
expect(results[1]).toEqual({
id: 'test:lower',
color: 'rgb(255, 0, 0)',
lines: { show: true, fill: false, lineWidth: 0 },

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { stdDeviationSibling } from '../std_deviation_sibling';
import { expect } from 'chai';
import sinon from 'sinon';
import { stdDeviationSibling } from './std_deviation_sibling';
describe('stdDeviationSibling(resp, panel, series)', () => {
let panel;
@ -79,18 +77,18 @@ describe('stdDeviationSibling(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
stdDeviationSibling(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('creates a series', () => {
test('creates a series', () => {
const next = results => results;
const results = stdDeviationSibling(resp, panel, series)(next)([]);
expect(results).to.have.length(2);
expect(results).toHaveLength(2);
expect(results[0]).to.eql({
expect(results[0]).toEqual({
id: 'test:lower',
color: 'rgb(255, 0, 0)',
lines: { show: true, fill: false, lineWidth: 0 },
@ -101,7 +99,7 @@ describe('stdDeviationSibling(resp, panel, series)', () => {
],
});
expect(results[1]).to.eql({
expect(results[1]).toEqual({
id: 'test:upper',
label: 'Overall Std. Deviation of Average of cpu',
color: 'rgb(255, 0, 0)',

View file

@ -17,9 +17,7 @@
* under the License.
*/
import sinon from 'sinon';
import { expect } from 'chai';
import { stdMetric } from '../std_metric';
import { stdMetric } from './std_metric';
describe('stdMetric(resp, panel, series)', () => {
let panel;
@ -60,41 +58,41 @@ describe('stdMetric(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
stdMetric(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('calls next when finished (percentile)', () => {
test('calls next when finished (percentile)', () => {
series.metrics[0].type = 'percentile';
const next = sinon.spy(d => d);
const next = jest.fn(d => d);
const results = stdMetric(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(results).to.have.length(0);
expect(next.mock.calls.length).toEqual(1);
expect(results).toHaveLength(0);
});
it('calls next when finished (std_deviation band)', () => {
test('calls next when finished (std_deviation band)', () => {
series.metrics[0].type = 'std_deviation';
series.metrics[0].mode = 'band';
const next = sinon.spy(d => d);
const next = jest.fn(d => d);
const results = stdMetric(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(results).to.have.length(0);
expect(next.mock.calls.length).toEqual(1);
expect(results).toHaveLength(0);
});
it('creates a series', () => {
test('creates a series', () => {
const next = results => results;
const results = stdMetric(resp, panel, series)(next)([]);
expect(results).to.have.length(1);
expect(results[0]).to.have.property('color', 'rgb(255, 0, 0)');
expect(results[0]).to.have.property('id', 'test');
expect(results[0]).to.have.property('label', 'Average of cpu');
expect(results[0]).to.have.property('lines');
expect(results[0]).to.have.property('stack');
expect(results[0]).to.have.property('bars');
expect(results[0]).to.have.property('points');
expect(results[0].data).to.eql([
expect(results).toHaveLength(1);
expect(results[0]).toHaveProperty('color', 'rgb(255, 0, 0)');
expect(results[0]).toHaveProperty('id', 'test');
expect(results[0]).toHaveProperty('label', 'Average of cpu');
expect(results[0]).toHaveProperty('lines');
expect(results[0]).toHaveProperty('stack');
expect(results[0]).toHaveProperty('bars');
expect(results[0]).toHaveProperty('points');
expect(results[0].data).toEqual([
[1, 1],
[2, 2],
]);

View file

@ -17,9 +17,7 @@
* under the License.
*/
import { stdSibling } from '../std_sibling';
import { expect } from 'chai';
import sinon from 'sinon';
import { stdSibling } from './std_sibling';
describe('stdSibling(resp, panel, series)', () => {
let panel;
@ -74,26 +72,26 @@ describe('stdSibling(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
stdSibling(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('calls next when std. deviation bands set', () => {
test('calls next when std. deviation bands set', () => {
series.metrics[1].mode = 'band';
const next = sinon.spy(results => results);
const next = jest.fn(results => results);
const results = stdSibling(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(results).to.have.length(0);
expect(next.mock.calls.length).toEqual(1);
expect(results).toHaveLength(0);
});
it('creates a series', () => {
test('creates a series', () => {
const next = results => results;
const results = stdSibling(resp, panel, series)(next)([]);
expect(results).to.have.length(1);
expect(results).toHaveLength(1);
expect(results[0]).to.eql({
expect(results[0]).toEqual({
id: 'test',
label: 'Overall Std. Deviation of Average of cpu',
color: 'rgb(255, 0, 0)',

View file

@ -17,10 +17,8 @@
* under the License.
*/
import sinon from 'sinon';
import { expect } from 'chai';
import { timeShift } from '../time_shift';
import { stdMetric } from '../std_metric';
import { timeShift } from './time_shift';
import { stdMetric } from './std_metric';
describe('timeShift(resp, panel, series)', () => {
let panel;
@ -62,24 +60,24 @@ describe('timeShift(resp, panel, series)', () => {
};
});
it('calls next when finished', () => {
const next = sinon.spy();
test('calls next when finished', () => {
const next = jest.fn();
timeShift(resp, panel, series)(next)([]);
expect(next.calledOnce).to.equal(true);
expect(next.mock.calls.length).toEqual(1);
});
it('creates a series', () => {
test('creates a series', () => {
const next = timeShift(resp, panel, series)(results => results);
const results = stdMetric(resp, panel, series)(next)([]);
expect(results).to.have.length(1);
expect(results[0]).to.have.property('color', 'rgb(255, 0, 0)');
expect(results[0]).to.have.property('id', 'test');
expect(results[0]).to.have.property('label', 'Average of cpu');
expect(results[0]).to.have.property('lines');
expect(results[0]).to.have.property('stack');
expect(results[0]).to.have.property('bars');
expect(results[0]).to.have.property('points');
expect(results[0].data).to.eql([
expect(results).toHaveLength(1);
expect(results[0]).toHaveProperty('color', 'rgb(255, 0, 0)');
expect(results[0]).toHaveProperty('id', 'test');
expect(results[0]).toHaveProperty('label', 'Average of cpu');
expect(results[0]).toHaveProperty('lines');
expect(results[0]).toHaveProperty('stack');
expect(results[0]).toHaveProperty('bars');
expect(results[0]).toHaveProperty('points');
expect(results[0].data).toEqual([
[1483225200000 + 3600000, 1],
[1483225210000 + 3600000, 2],
]);

View file

@ -17,6 +17,8 @@
* under the License.
*/
import { buildRequestBody } from './build_request_body';
const body = JSON.parse(`
{
"filters": [
@ -75,15 +77,11 @@ const body = JSON.parse(`
}
`);
import sinon from 'sinon';
import { expect } from 'chai';
import { buildRequestBody } from '../build_request_body';
describe('buildRequestBody(req)', () => {
it('returns a valid body', () => {
test('returns a valid body', () => {
const panel = body.panels[0];
const series = panel.series[0];
const getValidTimeInterval = sinon.spy(() => '10s');
const getValidTimeInterval = jest.fn(() => '10s');
const capabilities = {
searchTimezone: 'UTC',
getValidTimeInterval,
@ -102,7 +100,7 @@ describe('buildRequestBody(req)', () => {
capabilities
);
expect(doc).to.eql({
expect(doc).toEqual({
size: 0,
query: {
bool: {

View file

@ -18,6 +18,7 @@
*/
import { buildProcessorFunction } from '../build_processor_function';
// @ts-ignore
import { processors } from '../request_processors/series';
/**
@ -33,7 +34,7 @@ import { processors } from '../request_processors/series';
* ]
* @returns {Object} doc - processed body
*/
export function buildRequestBody(...args) {
export function buildRequestBody(...args: any[]) {
const processor = buildProcessorFunction(processors, ...args);
const doc = processor({});
return doc;