From e7c1574fbeb6fbed6826f06bd42e30b65a6b1db4 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 4 Mar 2024 23:05:59 +1100 Subject: [PATCH] fix testcontainers dependency --- Cargo.lock | 16 +++++++++++++--- Cargo.toml | 2 +- tests/common/mod.rs | 18 +++++++++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 867c056..9e567e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2684,8 +2684,9 @@ dependencies = [ [[package]] name = "testcontainers" -version = "0.14.0" -source = "git+http://github.com/sphenlee/testcontainers-rs?branch=feature/slee/upgrade-bollard#65a33017e9fc7492b3dfb7477ab85109e00e5336" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d2931d7f521af5bae989f716c3fa43a6af9af7ec7a5e21b59ae40878cec00" dependencies = [ "bollard-stubs", "futures", @@ -2698,6 +2699,15 @@ dependencies = [ "sha2", ] +[[package]] +name = "testcontainers-modules" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d0334776e1e8ee7c504a922c5236daf865ffe413aa630d84ae91dcce0b10bc3" +dependencies = [ + "testcontainers", +] + [[package]] name = "textwrap" version = "0.15.1" @@ -3342,7 +3352,7 @@ dependencies = [ "serde_json", "serde_yaml", "sqlx", - "testcontainers", + "testcontainers-modules", "thiserror", "tokio", "tokio-amqp", diff --git a/Cargo.toml b/Cargo.toml index 7ae2a41..4053ab4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,5 +55,5 @@ uuid = { version = "1.1.2", features = [ "v4", "serde" ] } xxhash-rust = { version = "0.8.6", features = ["xxh3"] } [dev-dependencies] +testcontainers-modules = { version = "0.3.5", features = ["rabbitmq", "postgres", "redis"] } pretty_assertions = "1.2.1" -testcontainers = { git = "http://github.com/sphenlee/testcontainers-rs", branch = "feature/slee/upgrade-bollard" } diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 56b8eca..506c05b 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,6 +1,12 @@ use highnoon::Result; use std::{future::Future, sync::Once}; use waterwheel::config::{self, Config}; +use testcontainers_modules::{ + rabbitmq::RabbitMq, + postgres::Postgres, + redis::{Redis, REDIS_PORT}, + testcontainers +}; const DEFAULT_LOG: &str = "warn,waterwheel=trace,highnoon=info,testcontainers=info,lapin=off"; static LOGGING_SETUP: Once = Once::new(); @@ -24,17 +30,23 @@ where let client = testcontainers::clients::Cli::default(); // start database - let postgres = client.run(testcontainers::images::postgres::Postgres::default()); + let postgres = client.run(Postgres::default() + .with_password("testpassword")); let port = postgres.get_host_port_ipv4(5432); - config.db_url = format!("postgres://postgres@localhost:{}/", port); + config.db_url = format!("postgres://postgres:testpassword@localhost:{}/", port); // start AMQP - let rabbit = client.run(testcontainers::images::rabbitmq::RabbitMq); + let rabbit = client.run(RabbitMq); let port = rabbit.get_host_port_ipv4(5672); config.amqp_addr = format!("amqp://localhost:{}//", port); + // start redis + let redis = client.run(Redis::default()); + let port = redis.get_host_port_ipv4(REDIS_PORT); + config.redis_url = format!("redis://localhost:{}", port); + // other config setup config.server_addr = "http://127.0.0.1:0/".to_owned(); config.no_authz = true;