1# This test runs influxdb and checks if influxdb is up and running
2
3import ./make-test-python.nix ({ pkgs, ...} : {
4 name = "victoriametrics";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ yorickvp ];
7 };
8
9 nodes = {
10 one = { ... }: {
11 services.victoriametrics.enable = true;
12 };
13 };
14
15 testScript = ''
16 start_all()
17
18 one.wait_for_unit("victoriametrics.service")
19
20 # write some points and run simple query
21 out = one.succeed(
22 "curl -f -d 'measurement,tag1=value1,tag2=value2 field1=123,field2=1.23' -X POST 'http://localhost:8428/write'"
23 )
24 cmd = (
25 """curl -f -s -G 'http://localhost:8428/api/v1/export' -d 'match={__name__!=""}'"""
26 )
27 # data takes a while to appear
28 one.wait_until_succeeds(f"[[ $({cmd} | wc -l) -ne 0 ]]")
29 out = one.succeed(cmd)
30 assert '"values":[123]' in out
31 assert '"values":[1.23]' in out
32 '';
33})