-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
577f440
commit 07347b2
Showing
45 changed files
with
170 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,32 @@ use std::env; | |
|
||
use tardis::basic::result::TardisResult; | ||
use tardis::test::test_container::TardisTestContainer; | ||
use tardis::testcontainers::clients::Cli; | ||
use tardis::testcontainers::Container; | ||
use tardis::testcontainers::GenericImage; | ||
use tardis::testcontainers::ContainerAsync; | ||
use tardis::TardisFuns; | ||
use testcontainers_modules::postgres::Postgres; | ||
use testcontainers_modules::rabbitmq::RabbitMq; | ||
use testcontainers_modules::redis::Redis; | ||
|
||
pub struct LifeHold<'a> { | ||
pub reldb: Container<'a, GenericImage>, | ||
pub redis: Container<'a, Redis>, | ||
pub rabbit: Container<'a, GenericImage>, | ||
pub struct LifeHold { | ||
pub reldb: ContainerAsync<Postgres>, | ||
pub redis: ContainerAsync<Redis>, | ||
pub rabbit: ContainerAsync<RabbitMq>, | ||
} | ||
|
||
pub async fn init(docker: &Cli, sql_init_path: Option<String>) -> TardisResult<LifeHold<'_>> { | ||
let reldb_container = TardisTestContainer::postgres_custom(sql_init_path.as_deref(), docker); | ||
let port = reldb_container.get_host_port_ipv4(5432); | ||
pub async fn init(sql_init_path: Option<String>) -> TardisResult<LifeHold> { | ||
let reldb_container = TardisTestContainer::postgres_custom(sql_init_path.as_deref()).await?; | ||
let port = reldb_container.get_host_port_ipv4(5432).await?; | ||
let url = format!("postgres://postgres:[email protected]:{port}/test"); | ||
env::set_var("TARDIS_FW.DB.URL", url); | ||
|
||
let redis_container = TardisTestContainer::redis_custom(docker); | ||
let port = redis_container.get_host_port_ipv4(6379); | ||
let redis_container = TardisTestContainer::redis_custom().await?; | ||
let port = redis_container.get_host_port_ipv4(6379).await?; | ||
let url = format!("redis://127.0.0.1:{port}/0"); | ||
env::set_var("TARDIS_FW.CACHE.URL", url); | ||
|
||
// TODO remove | ||
let rabbit_container = TardisTestContainer::rabbit_custom(docker); | ||
let port = rabbit_container.get_host_port_ipv4(5672); | ||
let rabbit_container = TardisTestContainer::rabbit_custom().await?; | ||
let port = rabbit_container.get_host_port_ipv4(5672).await?; | ||
let url = format!("amqp://guest:[email protected]:{port}/%2f"); | ||
env::set_var("TARDIS_FW.MQ.URL", url); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ use tardis::{ | |
chrono::{self, Utc}, | ||
rand::random, | ||
test::test_container::TardisTestContainer, | ||
testcontainers, tokio, TardisFuns, TardisFunsInst, | ||
tokio, TardisFuns, TardisFunsInst, | ||
}; | ||
|
||
mod test_common; | ||
|
@@ -23,19 +23,18 @@ fn funs() -> TardisFunsInst { | |
async fn test_basic_schedual_service() -> TardisResult<()> { | ||
// std::env::set_current_dir("middlewares/schedule").unwrap(); | ||
std::env::set_var("RUST_LOG", "info,sqlx=off,sea_orm=INFO"); | ||
let docker = testcontainers::clients::Cli::default(); | ||
let reldb_container = TardisTestContainer::postgres_custom(None, &docker); | ||
let port = reldb_container.get_host_port_ipv4(5432); | ||
let reldb_container = TardisTestContainer::postgres_custom(None).await?; | ||
let port = reldb_container.get_host_port_ipv4(5432).await?; | ||
let url = format!("postgres://postgres:[email protected]:{port}/test"); | ||
env::set_var("TARDIS_FW.DB.URL", url); | ||
|
||
let redis_container = TardisTestContainer::redis_custom(&docker); | ||
let port = redis_container.get_host_port_ipv4(6379); | ||
let redis_container = TardisTestContainer::redis_custom().await?; | ||
let port = redis_container.get_host_port_ipv4(6379).await?; | ||
let url = format!("redis://127.0.0.1:{port}/0"); | ||
env::set_var("TARDIS_FW.CACHE.URL", url); | ||
|
||
let rabbit_container = TardisTestContainer::rabbit_custom(&docker); | ||
let port = rabbit_container.get_host_port_ipv4(5672); | ||
let rabbit_container = TardisTestContainer::rabbit_custom().await?; | ||
let port = rabbit_container.get_host_port_ipv4(5672).await?; | ||
let url = format!("amqp://guest:[email protected]:{port}/%2f"); | ||
env::set_var("TARDIS_FW.MQ.URL", url); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.