File tree Expand file tree Collapse file tree 3 files changed +45
-5
lines changed
Expand file tree Collapse file tree 3 files changed +45
-5
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,21 @@ pub async fn get_flow_channel(uri: &str) -> FlowChannel {
2121 Err ( error) => panic ! ( "Cannot create channel {:?}" , error) ,
2222 }
2323}
24+
25+ #[ cfg( test) ]
26+ mod tests {
27+ use crate :: flow_queue:: connection:: connect;
28+ use testcontainers:: core:: { IntoContainerPort , WaitFor } ;
29+ use testcontainers:: runners:: AsyncRunner ;
30+ use testcontainers:: GenericImage ;
31+ use crate :: rabbitmq_container_test;
32+
33+ rabbitmq_container_test ! ( test_rabbitmq_startup, ( |url: String | async move {
34+ println!( "RabbitMQ started with the url: {}" , url) ;
35+ } ) ) ;
36+
37+ rabbitmq_container_test ! ( test_rabbitmq_connection, ( |url: String | async move {
38+ connect( & * url) . await ;
39+ } ) ) ;
40+
41+ }
Original file line number Diff line number Diff line change 11use redis:: Client ;
22
33pub fn build_connection ( redis_url : String ) -> Client {
4- Client :: open ( redis_url) . unwrap_or_else ( |err| {
5- panic ! ( "Cannot connect to redis instance! Reason: {err}" )
6- } )
7- }
4+ match Client :: open ( redis_url) {
5+ Ok ( client) => client,
6+ Err ( con_error) => panic ! ( "{}" , con_error) ,
7+ }
8+ }
9+
10+ #[ cfg( test) ]
11+ mod tests {
12+ use testcontainers:: core:: IntoContainerPort ;
13+ use testcontainers:: runners:: AsyncRunner ;
14+ use testcontainers:: GenericImage ;
15+ use testcontainers:: core:: WaitFor ;
16+ use crate :: flow_store:: connection:: build_connection;
17+ use crate :: redis_container_test;
18+
19+ redis_container_test ! ( test_redis_startup, ( |url: String | async move {
20+ println!( "Redis server started correctly on: {}" , url) ;
21+ } ) ) ;
22+
23+ redis_container_test ! ( test_redis_connection, ( |url: String | async move {
24+ let result = build_connection( url) . get_connection( ) ;
25+ assert!( result. is_ok( ) ) ;
26+ } ) ) ;
27+ }
Original file line number Diff line number Diff line change 22pub mod flow_store;
33
44#[ cfg( feature = "flow_queue" ) ]
5- pub mod flow_queue;
5+ pub mod flow_queue;
6+
7+ pub mod container;
You can’t perform that action at this time.
0 commit comments