aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/tests/cadvisor.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/tests/cadvisor.nix')
-rw-r--r--nixpkgs/nixos/tests/cadvisor.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/cadvisor.nix b/nixpkgs/nixos/tests/cadvisor.nix
new file mode 100644
index 00000000000..e60bae4b700
--- /dev/null
+++ b/nixpkgs/nixos/tests/cadvisor.nix
@@ -0,0 +1,35 @@
+import ./make-test.nix ({ pkgs, ... } : {
+ name = "cadvisor";
+ meta = with pkgs.stdenv.lib.maintainers; {
+ maintainers = [ offline ];
+ };
+
+ nodes = {
+ machine = { ... }: {
+ services.cadvisor.enable = true;
+ };
+
+ influxdb = { lib, ... }: with lib; {
+ services.cadvisor.enable = true;
+ services.cadvisor.storageDriver = "influxdb";
+ services.influxdb.enable = true;
+ };
+ };
+
+ testScript =
+ ''
+ startAll;
+ $machine->waitForUnit("cadvisor.service");
+ $machine->succeed("curl http://localhost:8080/containers/");
+
+ $influxdb->waitForUnit("influxdb.service");
+
+ # 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/");
+ '';
+})