Use cabal v2-exec to run io tests, include io tests in nix-shell by default; remove obsolete ncat dependency (#1673)
Use cabal v2-exec to run io tests, include io tests in nix-shell by default; remove obsolete ncat dependency
This commit is contained in:
@@ -194,7 +194,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- run:
|
- run:
|
||||||
name: Install testing scripts
|
name: Install testing scripts
|
||||||
command: nix-env -f default.nix -iA tests tests.ioTests tests.memoryTests
|
command: nix-env -f default.nix -iA tests tests.memoryTests
|
||||||
- run:
|
- run:
|
||||||
name: Skip tests on build failure
|
name: Skip tests on build failure
|
||||||
command: circleci-agent step halt
|
command: circleci-agent step halt
|
||||||
|
|||||||
+7
-7
@@ -80,26 +80,26 @@ postgrest-test-spec-postgresql-10
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Some additional modules like `ioTests`, `memoryTests`, `docker` and `release`
|
Some additional modules like `memoryTests`, `docker` and `release`
|
||||||
have large dependencies that would need to be built before the shell becomes
|
have large dependencies that would need to be built before the shell becomes
|
||||||
available, which could take an especially long time if the cachix binary cache
|
available, which could take an especially long time if the cachix binary cache
|
||||||
is not used. You can activate those by passing a flag to `nix-shell`, which
|
is not used. You can activate those by passing a flag to `nix-shell`, which
|
||||||
will make the respective utilites available:
|
will make the respective utilites available:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ nix-shell --arg ioTests true
|
$ nix-shell --arg memoryTests true
|
||||||
[nix-shell]$ postgrest-<tab>
|
[nix-shell]$ postgrest-<tab>
|
||||||
postgrest-lint postgrest-test-spec-postgresql-10
|
postgrest-lint postgrest-test-spec-postgresql-10
|
||||||
postgrest-style postgrest-test-spec-postgresql-11
|
postgrest-style postgrest-test-spec-postgresql-11
|
||||||
postgrest-style-check postgrest-test-spec-postgresql-12
|
postgrest-style-check postgrest-test-spec-postgresql-12
|
||||||
postgrest-test-io postgrest-test-spec-postgresql-13
|
postgrest-test-memory postgrest-test-spec-postgresql-13
|
||||||
postgrest-test-spec postgrest-test-spec-postgresql-9.5
|
postgrest-test-spec postgrest-test-spec-postgresql-9.5
|
||||||
postgrest-test-spec-all postgrest-test-spec-postgresql-9.6
|
postgrest-test-spec-all postgrest-test-spec-postgresql-9.6
|
||||||
...
|
...
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that `postgrest-test-io` is now also available.
|
Note that `postgrest-test-memory` is now also available.
|
||||||
|
|
||||||
To run one-off commands, you can also use `nix-shell --run <command>`, which
|
To run one-off commands, you can also use `nix-shell --run <command>`, which
|
||||||
will lauch the Nix shell, run that one command and exit. Note that the tab
|
will lauch the Nix shell, run that one command and exit. Note that the tab
|
||||||
@@ -138,14 +138,14 @@ temporary test databases:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run the tests against the most recent version of PostgreSQL:
|
# Run the tests against the most recent version of PostgreSQL:
|
||||||
$ nix-shell --arg tests true --run postgrest-test-spec
|
$ nix-shell --run postgrest-test-spec
|
||||||
|
|
||||||
# Run the tests against all supported versions of PostgreSQL:
|
# Run the tests against all supported versions of PostgreSQL:
|
||||||
$ nix-shell --arg tests true --run postgrest-test-spec-all
|
$ nix-shell --run postgrest-test-spec-all
|
||||||
|
|
||||||
# Run the tests against a specific version of PostgreSQL (use tab-completion in
|
# Run the tests against a specific version of PostgreSQL (use tab-completion in
|
||||||
# nix-shell to see all available versions):
|
# nix-shell to see all available versions):
|
||||||
$ nix-shell --arg tests true --run postgrest-test-spec-postgresql-9.5
|
$ nix-shell --run postgrest-test-spec-postgresql-9.5
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+9
-11
@@ -8,7 +8,6 @@
|
|||||||
, git
|
, git
|
||||||
, haskell
|
, haskell
|
||||||
, lib
|
, lib
|
||||||
, ncat
|
|
||||||
, postgresql
|
, postgresql
|
||||||
, postgresqlVersions
|
, postgresqlVersions
|
||||||
, postgrest
|
, postgrest
|
||||||
@@ -78,12 +77,14 @@ let
|
|||||||
checkedShellScript
|
checkedShellScript
|
||||||
name
|
name
|
||||||
''
|
''
|
||||||
|
env="$(cat ${postgrest.env})"
|
||||||
|
export PATH="$env/bin:${curl}/bin:$PATH"
|
||||||
|
|
||||||
rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
|
rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
|
||||||
cd "$rootdir"
|
cd "$rootdir"
|
||||||
|
|
||||||
export PATH="${postgrestStatic}/bin:${curl}/bin:${ncat}/bin:$PATH"
|
${cabal-install}/bin/cabal v2-build ${devCabalOptions}
|
||||||
|
${cabal-install}/bin/cabal v2-exec ${withTmpDb postgresql} "$rootdir"/test/io-tests.sh
|
||||||
${withTmpDb postgresql} "$rootdir"/test/io-tests.sh
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
testMemory =
|
testMemory =
|
||||||
@@ -110,16 +111,13 @@ buildEnv
|
|||||||
[
|
[
|
||||||
(testSpec "postgrest-test-spec" postgresql).bin
|
(testSpec "postgrest-test-spec" postgresql).bin
|
||||||
testSpecAllVersions.bin
|
testSpecAllVersions.bin
|
||||||
|
(testIO "postgrest-test-io" postgresql).bin
|
||||||
] ++ testSpecVersions;
|
] ++ testSpecVersions;
|
||||||
}
|
}
|
||||||
# The IO an memory tests have large dependencies (a static and a profiled
|
# The memory tests have large dependencies (a profiled build of PostgREST)
|
||||||
# build of PostgREST respectively) and are run less often than the spec
|
# and are run less often than the spec tests, so we don't include them in
|
||||||
# tests, so we don't include them in the default test environment. We make
|
# the default test environment. We make them available through a separate attribute:
|
||||||
# them available through separate attributes:
|
|
||||||
// {
|
// {
|
||||||
ioTests =
|
|
||||||
(testIO "postgrest-test-io" postgresql).bin;
|
|
||||||
|
|
||||||
memoryTests =
|
memoryTests =
|
||||||
(testMemory "postgrest-test-memory" postgresql).bin;
|
(testMemory "postgrest-test-memory" postgresql).bin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# We highly recommend that use the PostgREST binary cache by installing cachix
|
# We highly recommend that use the PostgREST binary cache by installing cachix
|
||||||
# (https://app.cachix.org/) and running `cachix use postgrest`.
|
# (https://app.cachix.org/) and running `cachix use postgrest`.
|
||||||
{ ioTests ? false, memoryTests ? false, docker ? false, release ? false }:
|
{ memoryTests ? false, docker ? false, release ? false }:
|
||||||
let
|
let
|
||||||
postgrest =
|
postgrest =
|
||||||
import ./default.nix;
|
import ./default.nix;
|
||||||
@@ -32,7 +32,6 @@ lib.overrideDerivation postgrest.env (
|
|||||||
postgrest.tests
|
postgrest.tests
|
||||||
postgrest.style
|
postgrest.style
|
||||||
]
|
]
|
||||||
++ lib.optional ioTests postgrest.tests.ioTests
|
|
||||||
++ lib.optional memoryTests postgrest.tests.memoryTests
|
++ lib.optional memoryTests postgrest.tests.memoryTests
|
||||||
++ lib.optional docker postgrest.docker
|
++ lib.optional docker postgrest.docker
|
||||||
++ lib.optional release postgrest.release;
|
++ lib.optional release postgrest.release;
|
||||||
|
|||||||
+1
-2
@@ -2,8 +2,7 @@
|
|||||||
# Run unit tests for Input/Ouput of PostgREST seen as a black box
|
# Run unit tests for Input/Ouput of PostgREST seen as a black box
|
||||||
# with test output in Test Anything Protocol format.
|
# with test output in Test Anything Protocol format.
|
||||||
#
|
#
|
||||||
# These tests expect that `postgrest` is on the PATH, as well as `curl` and
|
# These tests expect that `postgrest` is on the PATH, as well as `curl`
|
||||||
# `ncat` (from the nmap package in some distribution).
|
|
||||||
#
|
#
|
||||||
# References:
|
# References:
|
||||||
# [1] Test Anything Protocol
|
# [1] Test Anything Protocol
|
||||||
|
|||||||
Reference in New Issue
Block a user