Skip to content

Commit

Permalink
Fixed tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
olexiyb committed Jun 13, 2024
1 parent 8ebcba2 commit 7306ef6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions tests/migration_tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod common;
#[tokio::test]
#[serial]
async fn db_create_database() -> Result<(), PgEmbedError> {
let mut pg = common::setup(5432, PathBuf::from("data_test/db"), false, None).await?;
let mut pg = common::setup(5432, PathBuf::from("data_test").join("db"), false, None).await?;
pg.start_db().await?;
let db_name = "test";

Expand All @@ -28,7 +28,7 @@ async fn db_create_database() -> Result<(), PgEmbedError> {
#[tokio::test]
#[serial]
async fn db_drop_database() -> Result<(), PgEmbedError> {
let mut pg = common::setup(5432, PathBuf::from("data_test/db"), false, None).await?;
let mut pg = common::setup(5432, PathBuf::from("data_test").join("db"), false, None).await?;
pg.start_db().await?;
let db_name = "test";

Expand All @@ -45,7 +45,7 @@ async fn db_drop_database() -> Result<(), PgEmbedError> {
async fn db_migration() -> Result<(), PgEmbedError> {
let mut pg = common::setup(
5432,
PathBuf::from("data_test/db"),
PathBuf::from("data_test").join("db"),
false,
Some(PathBuf::from("migration_test")),
)
Expand Down
14 changes: 7 additions & 7 deletions tests/postgres_tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod common;
#[tokio::test]
#[serial]
async fn postgres_server_start_stop() -> Result<(), PgEmbedError> {
let mut pg = common::setup(5432, PathBuf::from("data_test/db"), false, None).await?;
let mut pg = common::setup(5432, PathBuf::from("data_test").join("db"), false, None).await?;
{
let server_status = *pg.server_status.lock().await;
assert_eq!(server_status, PgServerStatus::Initialized);
Expand All @@ -42,7 +42,7 @@ async fn postgres_server_start_stop() -> Result<(), PgEmbedError> {
#[tokio::test]
#[serial]
async fn postgres_server_drop() -> Result<(), PgEmbedError> {
let db_path = PathBuf::from("data_test/db");
let db_path = PathBuf::from(PathBuf::from("data_test").join("db"));
{
let mut pg = common::setup(5432, db_path.clone(), false, None).await?;
pg.start_db().await?;
Expand All @@ -60,8 +60,8 @@ async fn postgres_server_multiple_concurrent() -> Result<(), PgEmbedError> {
PgAccess::purge().await?;

let tasks = vec![
common::setup(5432, PathBuf::from("data_test/db1"), false, None),
common::setup(5434, PathBuf::from("data_test/db3"), false, None),
common::setup(5432, PathBuf::from(PathBuf::from("data_test").join("db1")), false, None),
common::setup(5434, PathBuf::from("data_test").join("db3"), false, None),
];

let wrap_with_mutex =
Expand Down Expand Up @@ -101,7 +101,7 @@ async fn postgres_server_multiple_concurrent() -> Result<(), PgEmbedError> {
#[tokio::test]
#[serial]
async fn postgres_server_persistent_true() -> Result<(), PgEmbedError> {
let db_path = PathBuf::from("data_test/db");
let db_path = PathBuf::from("data_test").join("db");
let mut database_dir = PathBuf::new();
let mut pw_file_path = PathBuf::new();
{
Expand All @@ -125,7 +125,7 @@ async fn postgres_server_persistent_true() -> Result<(), PgEmbedError> {
#[tokio::test]
#[serial]
async fn postgres_server_persistent_false() -> Result<(), PgEmbedError> {
let db_path = PathBuf::from("data_test/db");
let db_path = PathBuf::from("data_test").join("db");
{
let _pg = common::setup(5432, db_path.clone(), false, None).await?;
let file_exists = PgAccess::pg_version_file_exists(&db_path).await?;
Expand All @@ -140,7 +140,7 @@ async fn postgres_server_persistent_false() -> Result<(), PgEmbedError> {
#[tokio::test]
#[serial]
async fn postgres_server_timeout() -> Result<(), PgEmbedError> {
let database_dir = PathBuf::from("data_test/db");
let database_dir = PathBuf::from("data_test").join("db");
let _ = env_logger::Builder::from_env(Env::default().default_filter_or("info"))
.is_test(true)
.try_init();
Expand Down

0 comments on commit 7306ef6

Please sign in to comment.