about summary refs log tree commit diff
path: root/nixos/tests/postgresql.nix
diff options
context:
space:
mode:
authorRok Garbas <rok@garbas.si>2016-01-20 03:42:59 +0100
committerRok Garbas <rok@garbas.si>2016-01-20 03:42:59 +0100
commit109ba4c86166f9b7aa31ba45869ee93b0eecb2e0 (patch)
treede28ab18ee1cb7f03e8e806bc1a3857ad42701b0 /nixos/tests/postgresql.nix
parentdd9bad4aa43e6ee5ec8a67adc13578cedda084bc (diff)
nixos: add test for postgresql, fixes #11146
Diffstat (limited to 'nixos/tests/postgresql.nix')
-rw-r--r--nixos/tests/postgresql.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/nixos/tests/postgresql.nix b/nixos/tests/postgresql.nix
new file mode 100644
index 0000000000000..f17384b44ba60
--- /dev/null
+++ b/nixos/tests/postgresql.nix
@@ -0,0 +1,26 @@
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "postgresql";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ zagy ];
+  };
+
+  nodes = {
+    master =
+      { pkgs, config, ... }:
+
+      {
+        services.postgresql.enable = true;
+        services.postgresql.initialScript =  pkgs.writeText "postgresql-init.sql"
+          ''
+          CREATE ROLE postgres WITH superuser login createdb;
+          '';
+      };
+  };
+
+  testScript = ''
+    startAll;
+    $master->waitForUnit("postgresql");
+    $master->sleep(10); # Hopefully this is long enough!!
+    $master->succeed("echo 'select 1' | sudo -u postgres psql");
+  '';
+})