Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: world-id-protocol-services
services: # world-id-indexer
postgres:
image: postgres:latest
image: public.ecr.aws/docker/library/postgres:latest
ports:
- "5432:5432"
environment:
Expand All @@ -12,7 +12,7 @@ services: # world-id-indexer
- POSTGRES_DB=indexer_tests
# world-id-gateway
redis:
image: redis:latest
image: public.ecr.aws/docker/library/redis:latest
Comment thread
cursor[bot] marked this conversation as resolved.
ports:
- "6379:6379"
healthcheck:
Expand Down
22 changes: 13 additions & 9 deletions services/gateway/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ use alloy::primitives::Address;
use reqwest::{Client, StatusCode};
use std::time::Duration;
use testcontainers_modules::{
redis::{REDIS_PORT, Redis},
testcontainers::{ContainerAsync, ImageExt as _, runners::AsyncRunner as _},
redis::REDIS_PORT,
testcontainers::{
ContainerAsync, GenericImage, ImageExt as _,
core::{IntoContainerPort, WaitFor},
runners::AsyncRunner as _,
},
};
use world_id_gateway::{
BatchPolicyConfig, GatewayConfig, GatewayHandle, SignerArgs, defaults, spawn_gateway_for_tests,
Expand Down Expand Up @@ -34,7 +38,7 @@ pub(crate) struct TestGateway {
pub(crate) _handle: GatewayHandle,
pub(crate) _anvil: TestAnvil,
// Keep the Redis container alive for the duration of the test.
pub(crate) _redis: ContainerAsync<Redis>,
pub(crate) _redis: ContainerAsync<GenericImage>,
}

/// Spawn a test gateway backed by a forked anvil chain and a Redis container.
Expand Down Expand Up @@ -132,14 +136,14 @@ pub(crate) async fn spawn_test_gateway(batch_ms: Option<u64>) -> TestGateway {
/// Start a fresh Redis container and return its URL plus the container handle.
///
/// The container is automatically stopped and removed when the returned
/// `ContainerAsync<Redis>` is dropped — keep it alive for the duration of the
/// `ContainerAsync<GenericImage>` is dropped — keep it alive for the duration of the
/// test that needs the Redis instance.
#[allow(dead_code)]
pub(crate) async fn start_redis() -> (String, ContainerAsync<Redis>) {
// Use redis:latest so CI (which already pulls this tag via docker-compose)
// can start the container from the local image cache with no network pull.
let container = Redis::default()
.with_tag("latest")
pub(crate) async fn start_redis() -> (String, ContainerAsync<GenericImage>) {
// Use the ECR Public mirror to avoid Docker Hub rate limits.
let container = GenericImage::new("public.ecr.aws/docker/library/redis", "latest")
.with_exposed_port(REDIS_PORT.tcp())
.with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))
.start()
.await
.expect("failed to start Redis container");
Expand Down
Loading