Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ jobs:
strategy:
fail-fast: false
matrix:
pgVersion: [14, 15, 16, 17, 18]
name: PG ${{ matrix.pgVersion }}
pgVersion: [pg-14, pg-15, pg-16, pg-17, pg-18, oriole-17]
name: ${{ matrix.pgVersion }}
runs-on: ubuntu-24.04
defaults:
run:
Expand All @@ -84,25 +84,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:
Expand Down
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ 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-17";
postgresql = pkgs.orioledb.withPackages (p: [ p.postgis p.pg_safeupdate ]);
}
];

haskellPackages = pkgs.haskell.packages."${compiler}";
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "REST API for any Postgres database";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:wolfgangwalther/nixpkgs/orioledb-latest";
};

nixConfig = {
Expand Down
8 changes: 6 additions & 2 deletions nix/tools/withTools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ let
{ name, postgresql }:
let
commandName = "postgrest-with-${name}";
orioleOptions =
lib.optionalString
(name == "oriole-17")
" -c default_table_access_method='orioledb' -c shared_preload_libraries='orioledb'";
in
checkedShellScript
{
Expand Down Expand Up @@ -80,7 +84,7 @@ let
# On MacOS, it's 104 chars
# See: https://serverfault.com/questions/641347/check-if-a-path-exceeds-maximum-for-unix-domain-socket

pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" " \
pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" ${orioleOptions}" \
>> "$setuplog"

log "Creating a minimally privileged $PGUSER connection role..."
Expand All @@ -106,7 +110,7 @@ let
log "Starting replica on $replica_host"

# We set a low max_standby_streaming_delay to make the replication conflict fail faster in tests (otherwise it waits for the default 30s)
pg_ctl -D "$replica_dir" -l "$replica_dblog" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $replica_host -c log_statement=\"all\" -c max_standby_streaming_delay=\"3s\" " \
pg_ctl -D "$replica_dir" -l "$replica_dblog" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $replica_host -c log_statement=\"all\" -c max_standby_streaming_delay=\"3s\" ${orioleOptions}" \
>> "$setuplog"

>&2 echo "${commandName}: Replica enabled. You can connect to it with: psql 'postgres:///$PGDATABASE?host=$replica_host' -U postgres"
Expand Down
1 change: 1 addition & 0 deletions test/io/fixtures/load.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

\set ON_ERROR_STOP on

\ir ../../orioledb.sql
\ir database.sql
\ir db_config.sql
\ir roles.sql
Expand Down
2 changes: 2 additions & 0 deletions test/load/fixtures.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
\ir ../orioledb.sql

CREATE ROLE postgrest_test_anonymous;
CREATE ROLE postgrest_test_author;
GRANT postgrest_test_anonymous TO :"PGUSER";
Expand Down
1 change: 1 addition & 0 deletions test/observability/fixtures/load.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

\set ON_ERROR_STOP on

\ir ../../orioledb.sql
\ir database.sql
\ir roles.sql
\ir schema.sql
Expand Down
6 changes: 6 additions & 0 deletions test/orioledb.sql
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/spec/fixtures/load.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

\set ON_ERROR_STOP on

\ir ../../orioledb.sql
\ir database.sql
\ir roles.sql
\ir schema.sql
Expand Down
Loading