1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-18 08:50:11 -04:00
nixpkgs/nixos/tests/pgjwt.nix
ghpzin 00ce4be9e4
nixos/tests/pgjwt: fix test
- remove extra 'CREATE EXTENSION' statements added with sed to test.sql,
current test.sql already has them.
- change 'nodes.master.config' to 'nodes.master' according to eval warn:
evaluation warning: Module argument `nodes.master.config` is deprecated.
Use `nodes.master` instead.
2024-09-11 08:11:18 +03:00

35 lines
866 B
Nix

import ./make-test-python.nix ({ pkgs, lib, ...}:
with pkgs; {
name = "pgjwt";
meta = with lib.maintainers; {
maintainers = [ spinus willibutz ];
};
nodes = {
master = { ... }:
{
services.postgresql = {
enable = true;
extraPlugins = ps: with ps; [ pgjwt pgtap ];
};
};
};
testScript = { nodes, ... }:
let
sqlSU = "${nodes.master.services.postgresql.superUser}";
pgProve = "${pkgs.perlPackages.TAPParserSourceHandlerpgTAP}";
in
''
start_all()
master.wait_for_unit("postgresql")
master.succeed(
"${pkgs.gnused}/bin/sed -e '12 i SET 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"
)
'';
})