Skip to content

Commit 77100e2

Browse files
authored
chore: enable all extensions during pg_upgrade testing (#1051)
1 parent a38cefa commit 77100e2

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.github/workflows/test-pg-upgrade.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- develop
7-
- pcnc/auto-pg_upgrade-testing
7+
- pcnc/pg_upgrade-test-extensions
88
workflow_dispatch:
99

1010
permissions:
@@ -16,6 +16,7 @@ jobs:
1616
matrix:
1717
base_pg_version:
1818
- 15.1.1.60
19+
- 15.1.1.70
1920
runs-on: arm-runner
2021
timeout-minutes: 30
2122
defaults:
@@ -99,7 +100,9 @@ jobs:
99100
retries: 20
100101

101102
- name: Run migrations
102-
run: docker exec "$container" bash -c "/docker-entrypoint-initdb.d/migrate.sh > /tmp/migrate.log 2>&1"
103+
run: |
104+
docker cp ../../migrations/db/migrations "$container:/docker-entrypoint-initdb.d/"
105+
docker exec "$container" bash -c "/docker-entrypoint-initdb.d/migrate.sh > /tmp/migrate.log 2>&1"
103106
104107
- name: Run initial tests
105108
run: pg_prove "../../migrations/tests/test.sql"
@@ -108,6 +111,7 @@ jobs:
108111

109112
- name: Apply pre-upgrade fixtures
110113
run: |
114+
psql -f "./tests/97-enable-extensions.sql"
111115
psql -f "./tests/98-data-fixtures.sql"
112116
psql -f "./tests/99-fixtures.sql"
113117

tests/pg_upgrade/debug.sh

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ while ! docker exec -it pg_upgrade_test bash -c "pg_isready"; do
4646
done
4747

4848
echo "Running migrations"
49+
docker cp ../../migrations/db/migrations "pg_upgrade_test:/docker-entrypoint-initdb.d/"
4950
docker exec -it pg_upgrade_test bash -c '/docker-entrypoint-initdb.d/migrate.sh > /tmp/migrate.log 2>&1; exit $?'
5051
if [ $? -ne 0 ]; then
5152
echo "Running migrations failed. Exiting."
@@ -54,6 +55,7 @@ fi
5455

5556
echo "Running tests"
5657
pg_prove "../../migrations/tests/test.sql"
58+
psql -f "./tests/97-enable-extensions.sql"
5759
psql -f "./tests/98-data-fixtures.sql"
5860
psql -f "./tests/99-fixtures.sql"
5961

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
do $$
2+
declare
3+
ext record;
4+
begin
5+
for ext in (select * from pg_available_extensions where name not in (select extname from pg_extension) order by name)
6+
loop
7+
execute 'create extension if not exists ' || ext.name || ' cascade';
8+
end loop;
9+
end;
10+
$$;

0 commit comments

Comments
 (0)