nix: add postgrest-with-oriole-18
This commit is contained in:
@@ -75,8 +75,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Latest version is tested via `coverage` above.
|
||||
pgVersion: [14, 15, 16, 17, 18]
|
||||
name: PG ${{ matrix.pgVersion }}
|
||||
pgVersion: [pg-14, pg-15, pg-16, pg-17, oriole-18, pg-18]
|
||||
name: ${{ matrix.pgVersion }}
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
@@ -89,25 +89,25 @@ jobs:
|
||||
uses: ./.github/actions/setup-nix
|
||||
with:
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
tools: tests.testSpec.bin tests.testObservability.bin tests.testIO.bin tests.testBigSchema.bin withTools.pg-${{ matrix.pgVersion }}.bin cabalTools.update.bin
|
||||
tools: tests.testSpec.bin tests.testObservability.bin tests.testIO.bin tests.testBigSchema.bin withTools.${{ matrix.pgVersion }}.bin cabalTools.update.bin
|
||||
|
||||
- run: postgrest-cabal-update
|
||||
|
||||
- name: Run spec tests
|
||||
if: always()
|
||||
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-spec
|
||||
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-spec
|
||||
|
||||
- name: Run observability tests
|
||||
if: always()
|
||||
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-observability
|
||||
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-observability
|
||||
|
||||
- name: Run IO tests
|
||||
if: always()
|
||||
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-io -vv
|
||||
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-io -vv
|
||||
|
||||
- name: Run IO tests on a big schema
|
||||
if: always()
|
||||
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
|
||||
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
|
||||
|
||||
|
||||
memory:
|
||||
|
||||
@@ -58,6 +58,14 @@ let
|
||||
{ name = "pg-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
|
||||
{ name = "pg-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
|
||||
{ name = "pg-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
|
||||
{
|
||||
name = "oriole-18";
|
||||
postgresql = pkgs.orioledb.withPackages (p: [ p.postgis p.pg_safeupdate ]);
|
||||
config = "
|
||||
default_table_access_method = 'orioledb'
|
||||
shared_preload_libraries = 'orioledb, pg_stat_statements'
|
||||
";
|
||||
}
|
||||
];
|
||||
|
||||
haskellPackages = pkgs.haskell.packages."${compiler}";
|
||||
|
||||
@@ -31,3 +31,6 @@ A minimal example could look like this:
|
||||
}
|
||||
|
||||
This will expose the PostgREST server on localhost on the NixOS machine and allow anonymous access.
|
||||
|
||||
.. tip::
|
||||
NixOS also allows to quickly spin up different PostgreSQL versions or even forks this way. For example, to test the current beta version of `OrioleDB <https://www.orioledb.com>`_, use ``services.postgresql.package = pkgs.orioledb``.
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
}:
|
||||
let
|
||||
withTmpDb =
|
||||
{ name, postgresql }:
|
||||
{ name, postgresql, config ? "" }:
|
||||
let
|
||||
commandName = "postgrest-with-${name}";
|
||||
postgresqlConf = writeText "postgresql.conf" "
|
||||
postgresqlConf = writeText "postgresql.conf" ("
|
||||
autovacuum = false
|
||||
listen_addresses = ''
|
||||
log_statement = all
|
||||
shared_preload_libraries=pg_stat_statements
|
||||
";
|
||||
" + config);
|
||||
in
|
||||
checkedShellScript
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
\ir ../../orioledb.sql
|
||||
|
||||
/*
|
||||
This is a 2018 version of the apflora schema https://github.com/barbalex/apf2/tree/master/sql/apflora - latest version likely has differing contents
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
\ir ../../orioledb.sql
|
||||
\ir database.sql
|
||||
\ir db_config.sql
|
||||
\ir roles.sql
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
\ir ../orioledb.sql
|
||||
|
||||
CREATE ROLE postgrest_test_anonymous;
|
||||
CREATE ROLE postgrest_test_author;
|
||||
GRANT postgrest_test_anonymous TO :"PGUSER";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
\ir ../../orioledb.sql
|
||||
\ir database.sql
|
||||
\ir roles.sql
|
||||
\ir schema.sql
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
SELECT EXISTS (SELECT * FROM pg_available_extensions WHERE name = 'orioledb') AS is_orioledb_available \gset
|
||||
|
||||
\if :is_orioledb_available
|
||||
CREATE SCHEMA orioledb;
|
||||
CREATE EXTENSION orioledb WITH SCHEMA orioledb;
|
||||
\endif
|
||||
@@ -76,7 +76,7 @@ spec withConfig = withConfig baseCfg $
|
||||
}
|
||||
|
||||
it "only affects the source table rows if his direct embedding is an inner join" $ do
|
||||
get "/tasks?select=id,projects(id,clients!inner(id))&projects.clients.id=eq.2" `shouldRespondWith`
|
||||
get "/tasks?select=id,projects(id,clients!inner(id))&projects.clients.id=eq.2&order=id" `shouldRespondWith`
|
||||
[json|[
|
||||
{"id":1,"projects":null},
|
||||
{"id":2,"projects":null},
|
||||
|
||||
@@ -34,7 +34,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 1.11
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for a single filter on a view" $ do
|
||||
r <- request methodGet "/projects_view?id=gt.2"
|
||||
@@ -47,7 +47,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
liftIO $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 1.1
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs blocks info when using the buffers option" $ do
|
||||
r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; options=buffers") ""
|
||||
@@ -139,7 +139,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 0.06
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for an update" $ do
|
||||
r <- request methodPatch "/projects?id=eq.3"
|
||||
@@ -153,7 +153,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 1.13
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for a delete" $ do
|
||||
r <- request methodDelete "/projects?id=in.(1,2,3)"
|
||||
@@ -167,7 +167,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 1.16
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for a single upsert" $ do
|
||||
r <- request methodPut "/tiobe_pls?name=eq.Go"
|
||||
@@ -182,7 +182,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 3.55
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for 2 upserts" $ do
|
||||
r <- request methodPost "/tiobe_pls"
|
||||
@@ -197,7 +197,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 5.53
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for an upsert with 10 rows" $ do
|
||||
r <- request methodPost "/tiobe_pls"
|
||||
@@ -211,7 +211,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
liftIO $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 5.53
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for an upsert with 100 rows" $ do
|
||||
r <- request methodPost "/tiobe_pls"
|
||||
@@ -225,7 +225,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
liftIO $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 5.53
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the total cost for an upsert with 1000 rows" $ do
|
||||
r <- request methodPost "/tiobe_pls"
|
||||
@@ -239,7 +239,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
liftIO $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 5.53
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
it "outputs the plan for application/vnd.pgrst.object" $ do
|
||||
r <- request methodDelete "/projects?id=eq.6"
|
||||
@@ -266,7 +266,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
||||
resHeaders `shouldSatisfy` notZeroContentLength
|
||||
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
||||
totalCost `shouldBe` 68.56
|
||||
totalCost `shouldSatisfy` (> 0)
|
||||
|
||||
describe "text format" $ do
|
||||
it "outputs the total cost for a function call" $ do
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
\ir ../../orioledb.sql
|
||||
\ir database.sql
|
||||
\ir roles.sql
|
||||
\ir schema.sql
|
||||
|
||||
Reference in New Issue
Block a user