2014-05-27 20:54:43 +00:00
|
|
|
# This test runs influxdb and checks if influxdb is up and running
|
|
|
|
|
2015-07-12 10:09:40 +00:00
|
|
|
import ./make-test.nix ({ pkgs, ...} : {
|
2014-06-28 14:04:49 +00:00
|
|
|
name = "influxdb";
|
2015-07-12 10:09:40 +00:00
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ chaoflow offline ];
|
|
|
|
};
|
2014-06-28 14:04:49 +00:00
|
|
|
|
2014-05-27 20:54:43 +00:00
|
|
|
nodes = {
|
2018-07-20 20:56:59 +00:00
|
|
|
one = { ... }: {
|
2014-05-27 20:54:43 +00:00
|
|
|
services.influxdb.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$one->waitForUnit("influxdb.service");
|
|
|
|
|
|
|
|
# create database
|
|
|
|
$one->succeed(q~
|
2016-09-08 12:18:21 +00:00
|
|
|
curl -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE test"
|
2014-05-27 20:54:43 +00:00
|
|
|
~);
|
|
|
|
|
|
|
|
# write some points and run simple query
|
|
|
|
$one->succeed(q~
|
2016-09-08 12:18:21 +00:00
|
|
|
curl -XPOST 'http://localhost:8086/write?db=test' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
|
2014-05-27 20:54:43 +00:00
|
|
|
~);
|
|
|
|
$one->succeed(q~
|
2016-09-08 12:18:21 +00:00
|
|
|
curl -GET 'http://localhost:8086/query' --data-urlencode "db=test" --data-urlencode "q=SELECT \"value\" FROM \"cpu_load_short\" WHERE \"region\"='us-west'" | grep "0\.64"
|
2014-05-27 20:54:43 +00:00
|
|
|
~);
|
|
|
|
'';
|
2015-07-12 10:09:40 +00:00
|
|
|
})
|