From bcf51fca832fc68839404cbc1eb86ff267da15b4 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Thu, 27 Mar 2025 12:51:05 -0500 Subject: [PATCH 1/2] chore: run regress tests before migration tests This is to get more valuable feedback earlier in case of failure --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 9f2171f44..a0a347760 100644 --- a/flake.nix +++ b/flake.nix @@ -845,9 +845,6 @@ exit 1 fi - echo "Running migrations tests" - pg_prove -p 5435 -U supabase_admin -h localhost -d postgres -v ${./migrations/tests}/test.sql - mkdir -p $out/regression_output if ! pg_regress \ --use-existing \ @@ -863,6 +860,9 @@ exit 1 fi + echo "Running migrations tests" + pg_prove -p 5435 -U supabase_admin -h localhost -d postgres -v ${./migrations/tests}/test.sql + # Copy logs to output for logfile in $(find /tmp -name postgresql.log -type f); do cp "$logfile" $out/postgresql.log From 3dffc63f30dd8d27ef6d6e7dc0c3c03a651afbd6 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Mon, 31 Mar 2025 13:52:52 -0500 Subject: [PATCH 2/2] test: output default event triggers --- nix/tests/expected/evtrigs.out | 25 +++++++++++++++++++++++++ nix/tests/sql/evtrigs.sql | 9 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 nix/tests/expected/evtrigs.out create mode 100644 nix/tests/sql/evtrigs.sql diff --git a/nix/tests/expected/evtrigs.out b/nix/tests/expected/evtrigs.out new file mode 100644 index 000000000..c3b642701 --- /dev/null +++ b/nix/tests/expected/evtrigs.out @@ -0,0 +1,25 @@ +SELECT + e.evtname, + e.evtowner::regrole AS evtowner, + e.evtfoid::regproc AS evtfunction, + p.proowner::regrole AS function_owner +FROM pg_event_trigger e +JOIN pg_proc p + ON e.evtfoid = p.oid +WHERE p.prorettype = 'event_trigger'::regtype; + evtname | evtowner | evtfunction | function_owner +----------------------------------------+----------------+------------------------------------+---------------- + issue_pg_net_access | postgres | grant_pg_net_access | postgres + issue_pg_graphql_access | supabase_admin | grant_pg_graphql_access | supabase_admin + issue_graphql_placeholder | supabase_admin | set_graphql_placeholder | supabase_admin + pgrst_ddl_watch | supabase_admin | pgrst_ddl_watch | supabase_admin + pgrst_drop_watch | supabase_admin | pgrst_drop_watch | supabase_admin + graphql_watch_ddl | supabase_admin | graphql.increment_schema_version | supabase_admin + graphql_watch_drop | supabase_admin | graphql.increment_schema_version | supabase_admin + issue_pg_cron_access | supabase_admin | grant_pg_cron_access | postgres + pg_tle_event_trigger_for_drop_function | supabase_admin | pgtle.pg_tle_feature_info_sql_drop | supabase_admin + pgaudit_ddl_command_end | supabase_admin | pgaudit_ddl_command_end | supabase_admin + pgaudit_sql_drop | supabase_admin | pgaudit_sql_drop | supabase_admin + pgsodium_trg_mask_update | supabase_admin | pgsodium.trg_mask_update | supabase_admin +(12 rows) + diff --git a/nix/tests/sql/evtrigs.sql b/nix/tests/sql/evtrigs.sql new file mode 100644 index 000000000..f482dd7ed --- /dev/null +++ b/nix/tests/sql/evtrigs.sql @@ -0,0 +1,9 @@ +SELECT + e.evtname, + e.evtowner::regrole AS evtowner, + e.evtfoid::regproc AS evtfunction, + p.proowner::regrole AS function_owner +FROM pg_event_trigger e +JOIN pg_proc p + ON e.evtfoid = p.oid +WHERE p.prorettype = 'event_trigger'::regtype;