From c3a78c3ef93983f52f71f093103f296764cf96bb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 14 Sep 2021 12:09:49 +0200 Subject: [PATCH] chore(nix): backend tests --- nix/develop.nix | 7 ++++--- nix/uniworx/backend.nix | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/nix/develop.nix b/nix/develop.nix index 03a89f0ef..e4e29cf0a 100644 --- a/nix/develop.nix +++ b/nix/develop.nix @@ -1,9 +1,10 @@ { pkgs +, prev ? pkgs , doPortOffset ? true , doDevelopEnv ? true }: -with pkgs.lib; +with prev.lib; let withDevelop = action: '' @@ -198,7 +199,7 @@ let ${action} ''; - postgresSchema = pkgs.writeText "schema.sql" '' + postgresSchema = prev.writeText "schema.sql" '' CREATE USER uniworx WITH SUPERUSER; CREATE DATABASE uniworx_test; GRANT ALL ON DATABASE uniworx_test TO uniworx; @@ -206,7 +207,7 @@ let GRANT ALL ON DATABASE uniworx TO uniworx; ''; - postgresHba = pkgs.writeText "hba_file" '' + postgresHba = prev.writeText "hba_file" '' local all all trust ''; in withDevelop diff --git a/nix/uniworx/backend.nix b/nix/uniworx/backend.nix index 2a31434b7..fc1ceb525 100644 --- a/nix/uniworx/backend.nix +++ b/nix/uniworx/backend.nix @@ -72,8 +72,14 @@ in { build-tools = with final.pkgs; [ llvm_9 final.uniworx.hsPkgs.hspec-discover ]; testWrapper = let - testWrapper = prev.writeScript "test-wrapper" (import ../develop.nix { inherit pkgs; doDevelopEnv = false; } "$@"); - in singleton (toString testWrapper); + testWrapper = prev.writeScript "test-wrapper" (import ../develop.nix { inherit prev; pkgs = final; doDevelopEnv = false; } "$@"); + 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 ]; };