add test for stddev

pull/2354/head
ben hockey 2015-04-20 16:40:05 -05:00
parent 2b78e3c9e0
commit fad619a43b
1 changed files with 17 additions and 0 deletions

View File

@ -590,6 +590,23 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
queryDb: "%DB%",
expected: `{"results":[{"series":[{"name":"cpu","columns":["time","mean"],"values":[["1970-01-01T00:00:00Z",` + string(maxFloat64) + `]]}]}]}`,
},
{
reset: true,
name: "mean and stddev",
write: `{"database" : "%DB%", "retentionPolicy" : "%RP%", "points": [
{"name": "cpu", "timestamp": "2000-01-01T00:00:00Z", "fields": {"value": 2}},
{"name": "cpu", "timestamp": "2000-01-01T00:00:10Z", "fields": {"value": 4}},
{"name": "cpu", "timestamp": "2000-01-01T00:00:20Z", "fields": {"value": 4}},
{"name": "cpu", "timestamp": "2000-01-01T00:00:30Z", "fields": {"value": 4}},
{"name": "cpu", "timestamp": "2000-01-01T00:00:40Z", "fields": {"value": 5}},
{"name": "cpu", "timestamp": "2000-01-01T00:00:50Z", "fields": {"value": 5}},
{"name": "cpu", "timestamp": "2000-01-01T00:01:00Z", "fields": {"value": 7}},
{"name": "cpu", "timestamp": "2000-01-01T00:01:10Z", "fields": {"value": 9}}
]}`,
query: `SELECT mean(value), stddev(value) FROM cpu WHERE time >= '2000-01-01' AND time < '2000-01-01T00:02:00Z' GROUP BY time(10m)`,
queryDb: "%DB%",
expected: `{"results":[{"series":[{"name":"cpu","columns":["time","mean","stddev"],"values":[["2000-01-01T00:00:00Z",5,2.138089935299395]]}]}]}`,
},
{
reset: true,
name: "aggregations",