nixos: add test for postgresql, fixes #11146

+27
+1
nixos/release.nix
··· 287 287 tests.openssh = callTest tests/openssh.nix {}; 288 288 tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; }); 289 289 tests.peerflix = callTest tests/peerflix.nix {}; 290 + tests.postgresql = callTest tests/postgresql.nix {}; 290 291 tests.printing = callTest tests/printing.nix {}; 291 292 tests.proxy = callTest tests/proxy.nix {}; 292 293 tests.pumpio = callTest tests/pump.io.nix {};
+26
nixos/tests/postgresql.nix
··· 1 + import ./make-test.nix ({ pkgs, ...} : { 2 + name = "postgresql"; 3 + meta = with pkgs.stdenv.lib.maintainers; { 4 + maintainers = [ zagy ]; 5 + }; 6 + 7 + nodes = { 8 + master = 9 + { pkgs, config, ... }: 10 + 11 + { 12 + services.postgresql.enable = true; 13 + services.postgresql.initialScript = pkgs.writeText "postgresql-init.sql" 14 + '' 15 + CREATE ROLE postgres WITH superuser login createdb; 16 + ''; 17 + }; 18 + }; 19 + 20 + testScript = '' 21 + startAll; 22 + $master->waitForUnit("postgresql"); 23 + $master->sleep(10); # Hopefully this is long enough!! 24 + $master->succeed("echo 'select 1' | sudo -u postgres psql"); 25 + ''; 26 + })