File tree Expand file tree Collapse file tree 4 files changed +33
-23
lines changed
pgls_test_utils/testdb_migrations Expand file tree Collapse file tree 4 files changed +33
-23
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -39,19 +39,17 @@ pub struct SplinterQueryResult {
3939}
4040
4141pub async fn load_splinter_results ( pool : & PgPool ) -> Result < Vec < SplinterQueryResult > , sqlx:: Error > {
42- let mut tx = pool. begin ( ) . await ?;
42+ let mut conn = pool. acquire ( ) . await ?;
4343
4444 // this is done by the splinter.sql file normally, but we remove it so that sqlx can work with
4545 // the file properly.
4646 sqlx:: query ( "set local search_path = ''" )
47- . execute ( & mut * tx )
47+ . execute ( & mut * conn )
4848 . await ?;
4949
5050 let results = sqlx:: query_file_as!( SplinterQueryResult , "vendor/splinter.sql" )
51- . fetch_all ( & mut * tx )
51+ . fetch_all ( & mut * conn )
5252 . await ?;
5353
54- tx. commit ( ) . await ?;
55-
5654 Ok ( results)
5755}
Original file line number Diff line number Diff line change @@ -51,21 +51,6 @@ struct TestSetup<'a> {
5151
5252impl TestSetup < ' _ > {
5353 async fn test ( self ) {
54- // Create Supabase-specific roles that splinter expects
55- for role in [ "anon" , "authenticated" , "service_role" ] {
56- let result = sqlx:: query ( & format ! ( "CREATE ROLE {role} NOLOGIN" ) )
57- . execute ( self . test_db )
58- . await ;
59-
60- // Ignore duplicate role errors
61- if let Err ( sqlx:: Error :: Database ( db_err) ) = & result {
62- let code = db_err. code ( ) ;
63- if code. as_deref ( ) != Some ( "23505" ) && code. as_deref ( ) != Some ( "42710" ) {
64- result. expect ( "Failed to create Supabase roles" ) ;
65- }
66- }
67- }
68-
6954 // Run setup SQL
7055 sqlx:: raw_sql ( self . setup )
7156 . execute ( self . test_db )
Original file line number Diff line number Diff line change 2121
2222begin
2323 create role test_nologin;
24- exception
24+ exception
25+ when duplicate_object then
26+ null ;
27+ when unique_violation then
28+ null ;
29+ end;
30+
31+ -- Supabase roles required for splinter tests
32+ begin
33+ create role anon nologin;
34+ exception
35+ when duplicate_object then
36+ null ;
37+ when unique_violation then
38+ null ;
39+ end;
40+
41+ begin
42+ create role authenticated nologin;
43+ exception
44+ when duplicate_object then
45+ null ;
46+ when unique_violation then
47+ null ;
48+ end;
49+
50+ begin
51+ create role service_role nologin;
52+ exception
2553 when duplicate_object then
2654 null ;
2755 when unique_violation then
2856 null ;
2957end;
3058
31- end
59+ end
3260$$;
You can’t perform that action at this time.
0 commit comments