From 109ba4c86166f9b7aa31ba45869ee93b0eecb2e0 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Wed, 20 Jan 2016 03:42:59 +0100 Subject: [PATCH] nixos: add test for postgresql, fixes #11146 --- nixos/release.nix | 1 + nixos/tests/postgresql.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 nixos/tests/postgresql.nix diff --git a/nixos/release.nix b/nixos/release.nix index 8a502ae2baa..3c7cf84c672 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -287,6 +287,7 @@ in rec { tests.openssh = callTest tests/openssh.nix {}; tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; }); tests.peerflix = callTest tests/peerflix.nix {}; + tests.postgresql = callTest tests/postgresql.nix {}; tests.printing = callTest tests/printing.nix {}; tests.proxy = callTest tests/proxy.nix {}; tests.pumpio = callTest tests/pump.io.nix {}; diff --git a/nixos/tests/postgresql.nix b/nixos/tests/postgresql.nix new file mode 100644 index 00000000000..f17384b44ba --- /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"); + ''; +})