diff --git a/nixos/tests/cadvisor.nix b/nixos/tests/cadvisor.nix index c55b08c0e924..3a887514773a 100644 --- a/nixos/tests/cadvisor.nix +++ b/nixos/tests/cadvisor.nix @@ -13,10 +13,6 @@ import ./make-test.nix ({ pkgs, ... } : { services.cadvisor.enable = true; services.cadvisor.storageDriver = "influxdb"; services.influxdb.enable = true; - systemd.services.influxdb.postStart = mkAfter '' - ${pkgs.curl.bin}/bin/curl -X POST 'http://localhost:8086/db?u=root&p=root' \ - -d '{"name": "root"}' - ''; }; }; @@ -27,6 +23,15 @@ import ./make-test.nix ({ pkgs, ... } : { $machine->succeed("curl http://localhost:8080/containers/"); $influxdb->waitForUnit("influxdb.service"); + + # Wait until influxdb admin interface is available + $influxdb->waitUntilSucceeds("curl -f 127.0.0.1:8083"); + + # create influxdb database + $influxdb->succeed(q~ + curl -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE root" + ~); + $influxdb->waitForUnit("cadvisor.service"); $influxdb->succeed("curl http://localhost:8080/containers/"); '';