You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pytest.skip(f"Skipping pg_cron test for PostgreSQL version {postgres_version}")
581
581
582
-
# Connect as supabase_admin and create the extension
583
-
withhost.sudo("postgres"):
584
-
result=host.run('psql -U supabase_admin -d postgres -c "CREATE EXTENSION pg_cron WITH SCHEMA pg_catalog VERSION \'1.3.1\';"')
585
-
assertresult.rc==0, f"Failed to create pg_cron extension: {result.stderr}"
586
-
587
-
# Create test table
588
-
result=host.run('psql -U supabase_admin -d postgres -c "CREATE TABLE cron_test_log (id SERIAL PRIMARY KEY, message TEXT, log_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP);"')
589
-
assertresult.rc==0, f"Failed to create test table: {result.stderr}"
590
-
591
-
# Schedule a job
592
-
result=host.run('psql -U supabase_admin -d postgres -c "SELECT cron.schedule(\'* * * * *\', \'INSERT INTO cron_test_log (message) VALUES (\\\'Hello from pg_cron!\\\');\');"')
593
-
assertresult.rc==0, f"Failed to schedule job: {result.stderr}"
594
-
assert"1"inresult.stdout, "Expected schedule ID 1"
595
-
596
-
# Verify job is scheduled
597
-
result=host.run('psql -U supabase_admin -d postgres -c "SELECT * FROM cron.job;"')
598
-
assertresult.rc==0, f"Failed to query cron.job: {result.stderr}"
result=run_ssh_command(ssh, 'sudo -u postgres psql -d postgres -c "CREATE TABLE cron_test_log (id SERIAL PRIMARY KEY, message TEXT, log_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP);"')
622
+
assertresult['succeeded'], f"Failed to create test table: {result['stderr']}"
0 commit comments