Skip to content

Commit

Permalink
fix: test for github workflow action
Browse files Browse the repository at this point in the history
  • Loading branch information
luffy2025 committed Aug 6, 2024
1 parent d40134c commit e6e6ecf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions chat_server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ mod test_util {
pub async fn new_for_test(config: AppConfig) -> Result<(TestPg, Self), AppError> {
let dk = DecodingKey::load(&config.auth.pk).context("load pk failed")?;
let ek = EncodingKey::load(&config.auth.sk).context("load ek failed")?;
let post = config.server.db_url.rfind('/').expect("invalid db_url");
let server_url = &config.server.db_url[..post];
let (tdb, pool) = get_test_pool(Some(server_url)).await;
// let post = config.server.db_url.rfind('/').expect("invalid db_url");
// let server_url = &config.server.db_url[..post];
// let server_url = "postgres://postgres:postgres@localhost:5432";
// let (tdb, pool) = get_test_pool(Some(server_url)).await;
let (tdb, pool) = get_test_pool(None).await;
let state = Self {
inner: Arc::new(AppStateInner {
config,
Expand All @@ -121,7 +123,7 @@ mod test_util {
}

pub async fn get_test_pool(url: Option<&str>) -> (TestPg, PgPool) {
let url = url.unwrap_or("postgres://postgres:password@localhost:5432");
let url = url.unwrap_or("postgres://postgres:postgres@localhost:5432");
let tdb = TestPg::new(url.to_string(), std::path::Path::new("../migrations"));
let pool = tdb.get_pool().await;

Expand Down

0 comments on commit e6e6ecf

Please sign in to comment.