2019-11-06 16:45:57 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ...}:
|
|
|
|
|
2017-09-29 16:22:51 +02:00
|
|
|
with pkgs; {
|
2017-02-26 11:14:32 +01:00
|
|
|
name = "pgjwt";
|
2017-09-29 16:22:51 +02:00
|
|
|
meta = with lib.maintainers; {
|
|
|
|
maintainers = [ spinus willibutz ];
|
2017-02-26 11:14:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
2018-07-20 22:56:59 +02:00
|
|
|
master = { ... }:
|
2017-09-29 16:22:51 +02:00
|
|
|
{
|
|
|
|
services.postgresql = {
|
2017-10-04 13:01:01 +02:00
|
|
|
enable = true;
|
2023-09-26 22:49:44 +02:00
|
|
|
extraPlugins = ps: with ps; [ pgjwt pgtap ];
|
2017-02-26 11:14:32 +01:00
|
|
|
};
|
2017-09-29 16:22:51 +02:00
|
|
|
};
|
2017-02-26 11:14:32 +01:00
|
|
|
};
|
|
|
|
|
2017-09-29 16:22:51 +02:00
|
|
|
testScript = { nodes, ... }:
|
|
|
|
let
|
|
|
|
sqlSU = "${nodes.master.config.services.postgresql.superUser}";
|
|
|
|
pgProve = "${pkgs.perlPackages.TAPParserSourceHandlerpgTAP}";
|
|
|
|
in
|
|
|
|
''
|
2019-11-06 16:45:57 +01: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 11:14:32 +01:00
|
|
|
'';
|
|
|
|
})
|