chore(nix): backend tests

This commit is contained in:
Gregor Kleen 2021-09-14 12:09:49 +02:00
parent fd89f34746
commit c3a78c3ef9
2 changed files with 12 additions and 5 deletions

View File

@ -1,9 +1,10 @@
{ pkgs { pkgs
, prev ? pkgs
, doPortOffset ? true , doPortOffset ? true
, doDevelopEnv ? true , doDevelopEnv ? true
}: }:
with pkgs.lib; with prev.lib;
let let
withDevelop = action: '' withDevelop = action: ''
@ -198,7 +199,7 @@ let
${action} ${action}
''; '';
postgresSchema = pkgs.writeText "schema.sql" '' postgresSchema = prev.writeText "schema.sql" ''
CREATE USER uniworx WITH SUPERUSER; CREATE USER uniworx WITH SUPERUSER;
CREATE DATABASE uniworx_test; CREATE DATABASE uniworx_test;
GRANT ALL ON DATABASE uniworx_test TO uniworx; GRANT ALL ON DATABASE uniworx_test TO uniworx;
@ -206,7 +207,7 @@ let
GRANT ALL ON DATABASE uniworx TO uniworx; GRANT ALL ON DATABASE uniworx TO uniworx;
''; '';
postgresHba = pkgs.writeText "hba_file" '' postgresHba = prev.writeText "hba_file" ''
local all all trust local all all trust
''; '';
in withDevelop in withDevelop

View File

@ -72,8 +72,14 @@ in {
build-tools = with final.pkgs; [ llvm_9 final.uniworx.hsPkgs.hspec-discover ]; build-tools = with final.pkgs; [ llvm_9 final.uniworx.hsPkgs.hspec-discover ];
testWrapper = testWrapper =
let let
testWrapper = prev.writeScript "test-wrapper" (import ../develop.nix { inherit pkgs; doDevelopEnv = false; } "$@"); testWrapper = prev.writeScript "test-wrapper" (import ../develop.nix { inherit prev; pkgs = final; doDevelopEnv = false; } "$@");
in singleton (toString testWrapper); testWrapperWrapped = prev.runCommand "test-wrapper" { buildInputs = [final.makeWrapper]; } ''
makeWrapper ${testWrapper} $out \
--prefix PATH : ${final.postgresql_12}/bin \
--prefix PATH : ${final.minio}/bin \
--prefix PATH : ${final.memcached}/bin
'';
in singleton (toString testWrapperWrapped);
}; };
components.tests.hlint.build-tools = with final.pkgs; [ llvm_9 final.uniworx.hsPkgs.hlint-test ]; components.tests.hlint.build-tools = with final.pkgs; [ llvm_9 final.uniworx.hsPkgs.hlint-test ];
}; };