Skip to content

Commit ff963e9

Browse files
committed
fix!: define bootstrap superuser as postgres
1 parent 8c2e907 commit ff963e9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

postgresql_embedded/src/postgresql.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,13 @@ impl PostgreSQL {
365365
self.settings.host,
366366
self.settings.port
367367
);
368-
let psql = PsqlBuilder::new()
368+
let psql = PsqlBuilder::from(&self.settings)
369369
.program_dir(self.settings.binary_dir())
370370
.command(format!(
371371
"DROP DATABASE IF EXISTS \"{}\"",
372372
database_name.as_ref()
373373
))
374-
.host(&self.settings.host)
375-
.port(self.settings.port)
376-
.username(&self.settings.username)
377-
.pg_password(&self.settings.password)
374+
.username(BOOTSTRAP_SUPERUSER)
378375
.no_psqlrc();
379376

380377
match self.execute_command(psql).await {

postgresql_embedded/tests/postgresql.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,8 @@ async fn test_username_setting() -> Result<()> {
159159
postgresql.create_database(database_name).await?;
160160
let database_exists = postgresql.database_exists(database_name).await?;
161161
assert!(database_exists);
162+
postgresql.drop_database(database_name).await?;
163+
let database_exists = postgresql.database_exists(database_name).await?;
164+
assert!(!database_exists);
162165
Ok(())
163166
}

0 commit comments

Comments
 (0)