1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/nixos/tests/pgjwt.nix

35 lines
915 B
Nix
Raw Normal View History

2019-11-06 15:45:57 +00:00
import ./make-test-python.nix ({ pkgs, lib, ...}:
with pkgs; {
2017-02-26 10:14:32 +00:00
name = "pgjwt";
meta = with lib.maintainers; {
maintainers = [ spinus willibutz ];
2017-02-26 10:14:32 +00:00
};
nodes = {
master = { ... }:
{
services.postgresql = {
enable = true;
extraPlugins = [ pgjwt pgtap ];
2017-02-26 10:14:32 +00:00
};
};
2017-02-26 10:14:32 +00:00
};
testScript = { nodes, ... }:
let
sqlSU = "${nodes.master.config.services.postgresql.superUser}";
pgProve = "${pkgs.perlPackages.TAPParserSourceHandlerpgTAP}";
in
''
2019-11-06 15:45:57 +00:00
start_all()
master.wait_for_unit("postgresql")
master.succeed(
"${pkgs.gnused}/bin/sed -e '12 i CREATE EXTENSION pgcrypto;\\nCREATE EXTENSION pgtap;\\nSET search_path TO tap,public;' ${pgjwt.src}/test.sql > /tmp/test.sql"
)
master.succeed(
"${pkgs.sudo}/bin/sudo -u ${sqlSU} PGOPTIONS=--search_path=tap,public ${pgProve}/bin/pg_prove -d postgres -v -f /tmp/test.sql"
)
2017-02-26 10:14:32 +00:00
'';
})