use async_trait::async_trait; use tarantool_rs::Connection; use tarantool_test_container::testcontainers::ImageArgs; pub type TarantoolImage = tarantool_test_container::TarantoolImage; pub type TarantoolTestContainer = tarantool_test_container::TarantoolTestContainer; #[derive(Clone, Debug, Default)] pub struct TarantoolArgs {} impl ImageArgs for TarantoolArgs { fn into_iterator(self) -> Box> { vec!["tarantool".into(), "/opt/tarantool/test_data.lua".into()].into_iterator() } } #[async_trait] pub trait TarantoolTestContainerExt { fn new_with_test_data() -> Self; async fn create_conn(&self) -> Result; } #[async_trait] impl TarantoolTestContainerExt for TarantoolTestContainer { fn new_with_test_data() -> Self { let image = TarantoolImage::default().volume( format!("{}/tests", env!("CARGO_MANIFEST_DIR")), "/opt/tarantool".into(), ); Self::from_image(image) } async fn create_conn(&self) -> Result { Connection::builder() .build(format!("127.0.0.1:{}", self.connect_port())) .await } }