File tree Expand file tree Collapse file tree 1 file changed +0
-38
lines changed
Expand file tree Collapse file tree 1 file changed +0
-38
lines changed Original file line number Diff line number Diff line change @@ -146,41 +146,3 @@ pub fn require_database() -> Option<String> {
146146 }
147147 }
148148}
149-
150- #[ cfg( test) ]
151- mod tests {
152- use super :: * ;
153-
154- #[ tokio:: test]
155- async fn test_database_creation_and_cleanup ( ) {
156- let Some ( admin_url) = get_test_database_url ( ) else {
157- eprintln ! ( "Skipping: TEST_DATABASE_URL not set" ) ;
158- return ;
159- } ;
160-
161- // Create a test database
162- let test_db = TestDatabase :: new ( & admin_url) . await . unwrap ( ) ;
163- let db_name = test_db. db_name . clone ( ) ;
164-
165- // Verify we can connect to it
166- let client = test_db. connect ( ) . await . unwrap ( ) ;
167- let rows = client. query ( "SELECT 1 as value" , & [ ] ) . await . unwrap ( ) ;
168- assert_eq ! ( rows. len( ) , 1 ) ;
169-
170- // Drop the test database
171- drop ( test_db) ;
172-
173- // Verify the database was dropped
174- let ( admin_client, connection) = tokio_postgres:: connect ( & admin_url, NoTls ) . await . unwrap ( ) ;
175- tokio:: spawn ( async move {
176- let _ = connection. await ;
177- } ) ;
178-
179- let result = admin_client
180- . query ( "SELECT 1 FROM pg_database WHERE datname = $1" , & [ & db_name] )
181- . await
182- . unwrap ( ) ;
183-
184- assert ! ( result. is_empty( ) , "Database should have been dropped" ) ;
185- }
186- }
You can’t perform that action at this time.
0 commit comments