Skip to content

Commit 135779b

Browse files
committed
test: only run on pg 15 for this test, as 1.3.1 limited to 15
1 parent e870ba4 commit 135779b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

testinfra/test_ami_nix.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,10 @@ def gzip_then_base64_encode(s: str) -> str:
272272
- {{path: /etc/gotrue.env, content: {gzip_then_base64_encode(gotrue_env_content)}, permissions: '0664', encoding: gz+b64}}
273273
- {{path: /etc/wal-g/config.json, content: {gzip_then_base64_encode(walg_config_json_content)}, permissions: '0664', owner: 'wal-g:wal-g', encoding: gz+b64}}
274274
- {{path: /tmp/init.json, content: {gzip_then_base64_encode(init_json_content)}, permissions: '0600', encoding: gz+b64}}
275-
- {{path: /root/pg_extensions.json, content: {gzip_then_base64_encode('{"pg_cron":"1.3.1"}')}, permissions: '0644', encoding: gz+b64}}
276275
runcmd:
277276
- 'sudo echo \"pgbouncer\" \"postgres\" >> /etc/pgbouncer/userlist.txt'
278277
- 'cd /tmp && aws s3 cp --region ap-southeast-1 s3://init-scripts-staging/project/init.sh .'
278+
- 'if [ "$POSTGRES_MAJOR_VERSION" = "15" ]; then echo \'{"pg_cron":"1.3.1"}\' | sudo tee /root/pg_extensions.json && sudo chmod 644 /root/pg_extensions.json; fi'
279279
- 'bash init.sh "staging"'
280280
- 'touch /var/lib/init-complete'
281281
- 'rm -rf /tmp/*'
@@ -511,6 +511,11 @@ def test_postgrest_ending_empty_key_query_parameter_is_removed(host):
511511

512512

513513
def test_pg_cron_extension(host):
514+
# Only run this test for PostgreSQL 15
515+
postgres_version = os.environ.get("POSTGRES_MAJOR_VERSION")
516+
if postgres_version != "15":
517+
pytest.skip(f"Skipping pg_cron test for PostgreSQL version {postgres_version}")
518+
514519
# Connect as supabase_admin and create the extension
515520
with host.sudo("postgres"):
516521
result = host.run('psql -U supabase_admin -d postgres -c "CREATE EXTENSION pg_cron WITH SCHEMA pg_catalog VERSION \'1.3.1\';"')

0 commit comments

Comments
 (0)