mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-18 02:05:51 +03:00
3539e16cfa
- removed unneeded initscript - use default postgres version for the test
38 lines
1009 B
Nix
38 lines
1009 B
Nix
import ./make-test.nix ({ pkgs, lib, ...}:
|
|
let
|
|
test = with pkgs; runCommand "patch-test" {
|
|
nativeBuildInputs = [ pgjwt ];
|
|
}
|
|
''
|
|
sed -e '12 i CREATE EXTENSION pgcrypto;\nCREATE EXTENSION pgtap;\nSET search_path TO tap,public;' ${pgjwt.src}/test.sql > $out;
|
|
'';
|
|
in
|
|
with pkgs; {
|
|
name = "pgjwt";
|
|
meta = with lib.maintainers; {
|
|
maintainers = [ spinus willibutz ];
|
|
};
|
|
|
|
nodes = {
|
|
master = { pkgs, config, ... }:
|
|
{
|
|
services.postgresql = {
|
|
enable = true;
|
|
extraPlugins = [ pgjwt pgtap ];
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = { nodes, ... }:
|
|
let
|
|
sqlSU = "${nodes.master.config.services.postgresql.superUser}";
|
|
pgProve = "${pkgs.perlPackages.TAPParserSourceHandlerpgTAP}";
|
|
in
|
|
''
|
|
startAll;
|
|
$master->waitForUnit("postgresql");
|
|
$master->copyFileFromHost("${test}","/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");
|
|
'';
|
|
})
|