about summary refs log tree commit diff
path: root/nixos/tests/influxdb.nix
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2014-05-27 22:54:43 +0200
committerJaka Hudoklin <jakahudoklin@gmail.com>2014-05-27 22:56:36 +0200
commit66456c07989282f63a8425cc3a4554a79f1b6709 (patch)
treee1b9acd00daefac7897f79d0f1246a1922fd10f6 /nixos/tests/influxdb.nix
parent6bfb25b9e870ef080120108e2b1a94ace725a015 (diff)
nixos: add influxdb module
Diffstat (limited to 'nixos/tests/influxdb.nix')
-rw-r--r--nixos/tests/influxdb.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nixos/tests/influxdb.nix b/nixos/tests/influxdb.nix
new file mode 100644
index 0000000000000..278b264170faa
--- /dev/null
+++ b/nixos/tests/influxdb.nix
@@ -0,0 +1,34 @@
+# This test runs influxdb and checks if influxdb is up and running
+
+import ./make-test.nix {
+  nodes = {
+    one = { config, pkgs, ... }: {
+      services.influxdb.enable = true;
+    };
+  };
+
+  testScript = ''
+    startAll;
+  
+    $one->waitForUnit("influxdb.service");
+
+    # Check if admin interface is avalible
+    $one->waitUntilSucceeds("curl -f 127.0.0.1:8083");
+
+    # create database
+    $one->succeed(q~
+      curl -X POST 'http://localhost:8086/db?u=root&p=root' \
+        -d '{"name": "test"}'
+    ~);
+
+    # write some points and run simple query
+    $one->succeed(q~
+      curl -X POST 'http://localhost:8086/db/test/series?u=root&p=root' \
+        -d '[{"name":"foo","columns":["val"],"points":[[6666]]}]'
+    ~);
+    $one->succeed(q~
+      curl -G 'http://localhost:8086/db/test/series?u=root&p=root' \
+        --data-urlencode 'q=select * from foo limit 1' | grep 6666
+    ~);
+  '';
+}