Skip to content

Commit 71d1dbe

Browse files
committed
test: update e2e test to use dummy table
We no longer precreate Storage objects
1 parent 4266f30 commit 71d1dbe

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

testinfra/test_ami_nix.py

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
ALTER USER supabase_etl_admin WITH PASSWORD 'postgres';
3535
ALTER ROLE supabase_read_only_user WITH PASSWORD 'postgres';
3636
ALTER ROLE supabase_admin SET search_path TO "$user",public,auth,extensions;
37+
38+
-- dummy schema
39+
CREATE TABLE public.my_table();
40+
ALTER TABLE public.my_table OWNER TO postgres;
3741
"""
3842
realtime_env_content = ""
3943
adminapi_yaml_content = """
@@ -108,7 +112,7 @@
108112
)
109113
postgrest_base_conf_content = """
110114
db-uri = "postgres://authenticator:postgres@localhost:5432/postgres?application_name=postgrest"
111-
db-schema = "public, storage, graphql_public"
115+
db-schema = "public, graphql_public"
112116
db-anon-role = "anon"
113117
jwt-secret = "my_jwt_secret_which_is_not_so_secret"
114118
role-claim-key = ".role"
@@ -447,11 +451,10 @@ def test_postgrest_responds_to_requests(host):
447451
def test_postgrest_can_connect_to_db(host):
448452
"""Test if PostgREST can connect to the database."""
449453
res = requests.get(
450-
f"http://{host['ip']}/rest/v1/buckets",
454+
f"http://{host['ip']}/rest-admin/v1/ready",
451455
headers={
452456
"apikey": service_role_key,
453457
"authorization": f"Bearer {service_role_key}",
454-
"accept-profile": "storage",
455458
},
456459
)
457460
assert res.ok
@@ -460,10 +463,7 @@ def test_postgrest_can_connect_to_db(host):
460463
def test_postgrest_starting_apikey_query_parameter_is_removed(host):
461464
"""Test if PostgREST removes apikey query parameter at start."""
462465
res = requests.get(
463-
f"http://{host['ip']}/rest/v1/buckets",
464-
headers={
465-
"accept-profile": "storage",
466-
},
466+
f"http://{host['ip']}/rest/v1/my_table",
467467
params={
468468
"apikey": service_role_key,
469469
"id": "eq.absent",
@@ -476,10 +476,7 @@ def test_postgrest_starting_apikey_query_parameter_is_removed(host):
476476
def test_postgrest_middle_apikey_query_parameter_is_removed(host):
477477
"""Test if PostgREST removes apikey query parameter in middle."""
478478
res = requests.get(
479-
f"http://{host['ip']}/rest/v1/buckets",
480-
headers={
481-
"accept-profile": "storage",
482-
},
479+
f"http://{host['ip']}/rest/v1/my_table",
483480
params={
484481
"id": "eq.absent",
485482
"apikey": service_role_key,
@@ -492,10 +489,7 @@ def test_postgrest_middle_apikey_query_parameter_is_removed(host):
492489
def test_postgrest_ending_apikey_query_parameter_is_removed(host):
493490
"""Test if PostgREST removes apikey query parameter at end."""
494491
res = requests.get(
495-
f"http://{host['ip']}/rest/v1/buckets",
496-
headers={
497-
"accept-profile": "storage",
498-
},
492+
f"http://{host['ip']}/rest/v1/my_table",
499493
params={
500494
"id": "eq.absent",
501495
"name": "eq.absent",
@@ -508,10 +502,7 @@ def test_postgrest_ending_apikey_query_parameter_is_removed(host):
508502
def test_postgrest_starting_empty_key_query_parameter_is_removed(host):
509503
"""Test if PostgREST removes empty key query parameter at start."""
510504
res = requests.get(
511-
f"http://{host['ip']}/rest/v1/buckets",
512-
headers={
513-
"accept-profile": "storage",
514-
},
505+
f"http://{host['ip']}/rest/v1/my_table",
515506
params={
516507
"": "empty_key",
517508
"id": "eq.absent",
@@ -524,10 +515,7 @@ def test_postgrest_starting_empty_key_query_parameter_is_removed(host):
524515
def test_postgrest_middle_empty_key_query_parameter_is_removed(host):
525516
"""Test if PostgREST removes empty key query parameter in middle."""
526517
res = requests.get(
527-
f"http://{host['ip']}/rest/v1/buckets",
528-
headers={
529-
"accept-profile": "storage",
530-
},
518+
f"http://{host['ip']}/rest/v1/my_table",
531519
params={
532520
"apikey": service_role_key,
533521
"": "empty_key",
@@ -540,10 +528,7 @@ def test_postgrest_middle_empty_key_query_parameter_is_removed(host):
540528
def test_postgrest_ending_empty_key_query_parameter_is_removed(host):
541529
"""Test if PostgREST removes empty key query parameter at end."""
542530
res = requests.get(
543-
f"http://{host['ip']}/rest/v1/buckets",
544-
headers={
545-
"accept-profile": "storage",
546-
},
531+
f"http://{host['ip']}/rest/v1/my_table",
547532
params={
548533
"id": "eq.absent",
549534
"apikey": service_role_key,

0 commit comments

Comments
 (0)