1 # This test runs influxdb and checks if influxdb is up and running
3 import ./make-test-python.nix ({ pkgs, ...} : {
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ offline ];
11 services.influxdb.enable = true;
12 environment.systemPackages = [ pkgs.httpie ];
21 one.wait_for_unit("influxdb.service")
25 "curl -XPOST http://localhost:8086/query --data-urlencode 'q=CREATE DATABASE test'"
28 # write some points and run simple query
30 "curl -XPOST 'http://localhost:8086/write?db=test' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'"
33 qv = "SELECT value FROM cpu_load_short WHERE region='us-west'"
34 cmd = f'curl -GET "http://localhost:8086/query?db=test" --data-urlencode {shlex.quote("q="+ qv)}'
35 out = one.succeed(cmd)
37 assert "2015-06-11T20:46:02Z" in out