nix(refactor): Split memoryTest from tests.nix into memory.nix
This commit is contained in:
committed by
Wolfgang Walther
parent
e199337a53
commit
2e73886adc
@@ -172,7 +172,7 @@ jobs:
|
||||
cachix use postgrest
|
||||
- run:
|
||||
name: Install testing scripts
|
||||
command: nix-env -f default.nix -iA tests tests.memoryTests withTools
|
||||
command: nix-env -f default.nix -iA tests memory withTools
|
||||
- run:
|
||||
name: Run coverage (io tests and spec tests against PostgreSQL 13)
|
||||
command: postgrest-coverage
|
||||
|
||||
+5
-1
@@ -118,11 +118,15 @@ rec {
|
||||
# Scripts for running tests.
|
||||
tests =
|
||||
pkgs.callPackage nix/tests.nix {
|
||||
inherit postgrest postgrestProfiled devCabalOptions withTools;
|
||||
inherit postgrest devCabalOptions withTools;
|
||||
ghc = pkgs.haskell.compiler."${compiler}";
|
||||
hpc-codecov = pkgs.haskell.packages."${compiler}".hpc-codecov;
|
||||
};
|
||||
|
||||
# Script for running memory tests.
|
||||
memory =
|
||||
pkgs.callPackage nix/memory.nix { inherit postgrestProfiled withTools; };
|
||||
|
||||
# Linting and styling scripts.
|
||||
style =
|
||||
pkgs.callPackage nix/style.nix { };
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# The memory tests have large dependencies (a profiled build of PostgREST)
|
||||
# and are run less often than the spec tests, so we don't include them in
|
||||
# the default test environment. We make them available through a separate module.
|
||||
{ buildEnv
|
||||
, checkedShellScript
|
||||
, curl
|
||||
, postgrestProfiled
|
||||
, withTools
|
||||
}:
|
||||
let
|
||||
test =
|
||||
checkedShellScript
|
||||
{
|
||||
name = "postgrest-test-memory";
|
||||
docs = "Run the memory tests.";
|
||||
inRootDir = true;
|
||||
}
|
||||
''
|
||||
export PATH="${postgrestProfiled}/bin:${curl}/bin:$PATH"
|
||||
|
||||
${withTools.latest} test/memory-tests.sh
|
||||
'';
|
||||
|
||||
in
|
||||
buildEnv
|
||||
{
|
||||
name = "postgrest-memory";
|
||||
|
||||
paths = [ test.bin ];
|
||||
} // { bashCompletion = test.bashCompletion; }
|
||||
+1
-23
@@ -3,7 +3,6 @@
|
||||
{ buildEnv
|
||||
, cabal-install
|
||||
, checkedShellScript
|
||||
, curl
|
||||
, devCabalOptions
|
||||
, ghc
|
||||
, glibcLocales
|
||||
@@ -11,7 +10,6 @@
|
||||
, haskell
|
||||
, hpc-codecov
|
||||
, postgrest
|
||||
, postgrestProfiled
|
||||
, python3
|
||||
, runtimeShell
|
||||
, withTools
|
||||
@@ -69,19 +67,6 @@ let
|
||||
${ioTestPython}/bin/pytest -- -v test/io-tests "''${_arg_leftovers[@]}"
|
||||
'';
|
||||
|
||||
testMemory =
|
||||
checkedShellScript
|
||||
{
|
||||
name = "postgrest-test-memory";
|
||||
docs = "Run the memory tests.";
|
||||
inRootDir = true;
|
||||
}
|
||||
''
|
||||
export PATH="${postgrestProfiled}/bin:${curl}/bin:$PATH"
|
||||
|
||||
${withTools.latest} test/memory-tests.sh
|
||||
'';
|
||||
|
||||
dumpSchema =
|
||||
checkedShellScript
|
||||
{
|
||||
@@ -192,11 +177,4 @@ buildEnv
|
||||
"postgrest-tests";
|
||||
|
||||
paths = builtins.map (tool: tool.bin) tools;
|
||||
} // {
|
||||
inherit bashCompletion;
|
||||
|
||||
# The memory tests have large dependencies (a profiled build of PostgREST)
|
||||
# and are run less often than the spec tests, so we don't include them in
|
||||
# the default test environment. We make them available through a separate attribute:
|
||||
memoryTests = testMemory;
|
||||
}
|
||||
} // { inherit bashCompletion; }
|
||||
|
||||
@@ -41,7 +41,7 @@ lib.overrideDerivation postgrest.env (
|
||||
postgrest.nixpkgsUpgrade.bin
|
||||
]
|
||||
++ modules
|
||||
++ lib.optional memoryTests postgrest.tests.memoryTests.bin
|
||||
++ lib.optional memoryTests postgrest.memory
|
||||
++ lib.optional docker postgrest.docker;
|
||||
|
||||
shellHook =
|
||||
@@ -53,7 +53,7 @@ lib.overrideDerivation postgrest.env (
|
||||
builtins.map (bashCompletion: "source ${bashCompletion}") (
|
||||
builtins.concatLists (builtins.map (module: module.bashCompletion) modules)
|
||||
++ [ postgrest.hsie.bashCompletion postgrest.nixpkgsUpgrade.bashCompletion ]
|
||||
++ lib.optional memoryTests postgrest.tests.memoryTests.bashCompletion
|
||||
++ lib.optional memoryTests postgrest.memory.bashCompletion
|
||||
++ lib.optional docker postgrest.docker.bashCompletion
|
||||
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user