1# This test runs influxdb and checks if influxdb is up and running
2
3import ./make-test.nix ({ pkgs, ...} : {
4 name = "influxdb";
5 meta = with pkgs.stdenv.lib.maintainers; {
6 maintainers = [ chaoflow offline ];
7 };
8
9 nodes = {
10 one = { config, pkgs, ... }: {
11 services.influxdb.enable = true;
12 };
13 };
14
15 testScript = ''
16 startAll;
17
18 $one->waitForUnit("influxdb.service");
19
20 # Check if admin interface is avalible
21 $one->waitUntilSucceeds("curl -f 127.0.0.1:8083");
22
23 # create database
24 $one->succeed(q~
25 curl -X POST 'http://localhost:8086/db?u=root&p=root' \
26 -d '{"name": "test"}'
27 ~);
28
29 # write some points and run simple query
30 $one->succeed(q~
31 curl -X POST 'http://localhost:8086/db/test/series?u=root&p=root' \
32 -d '[{"name":"foo","columns":["val"],"points":[[6666]]}]'
33 ~);
34 $one->succeed(q~
35 curl -G 'http://localhost:8086/db/test/series?u=root&p=root' \
36 --data-urlencode 'q=select * from foo limit 1' | grep 6666
37 ~);
38 '';
39})