From a52c114ff43c4576d491106df11177bcb8a8cdbb Mon Sep 17 00:00:00 2001 From: monacoremo Date: Sun, 13 Dec 2020 21:17:37 +0100 Subject: [PATCH] add test for spec idempotence --- .circleci/config.yml | 4 ++++ nix/devtools.nix | 2 ++ nix/tests.nix | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f09cb966c..918af68ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -221,6 +221,10 @@ jobs: name: Run the spec tests against PostgreSQL 13 command: postgrest-test-spec-postgresql-13 when: always + - run: + name: Check the spec tests for idempotence + command: postgrest-test-spec-idempotence + when: always - run: name: Run io tests command: postgrest-test-io diff --git a/nix/devtools.nix b/nix/devtools.nix index df64d84cb..fbd46a3f8 100644 --- a/nix/devtools.nix +++ b/nix/devtools.nix @@ -44,6 +44,8 @@ let checkedShellScript "postgrest-check" '' ${tests}/bin/postgrest-test-spec-all + ${tests}/bin/postgrest-test-spec-idempotence + ${tests}/bin/postgrest-test-io ${style}/bin/postgrest-lint ${style}/bin/postgrest-style-check ''; diff --git a/nix/tests.nix b/nix/tests.nix index 7eb23d058..23f9816d6 100644 --- a/nix/tests.nix +++ b/nix/tests.nix @@ -24,7 +24,7 @@ let postgresql: checkedShellScript "postgrest-test-${postgresql.name}" '' - export PATH=${postgresql}/bin:${git}/bin:${runtimeShell}/bin:"$PATH" + export PATH=${postgresql}/bin:${git}/bin:"$PATH" exec ${../test/with_tmp_db} "$@" ''; @@ -58,6 +58,19 @@ let EOF ''; + testSpecIdempotence = + name: postgrestql: + checkedShellScript + name + '' + env="$(cat ${postgrest.env})" + export PATH="$env/bin:$PATH" + + ${withTmpDb postgresql} ${runtimeShell} -c " \ + ${cabal-install}/bin/cabal v2-test ${devCabalOptions} && \ + ${cabal-install}/bin/cabal v2-test ${devCabalOptions}" + ''; + # Create a `testSpec` for each PostgreSQL version that we want to test # against. testSpecVersions = @@ -123,6 +136,7 @@ buildEnv paths = [ (testSpec "postgrest-test-spec" postgresql).bin + (testSpecIdempotence "postgrest-test-spec-idempotence" postgresql).bin testSpecAllVersions.bin (testIO "postgrest-test-io" postgresql).bin ] ++ testSpecVersions;