diff --git a/README.md b/README.md index cd4b93a..8f73d87 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,19 @@ Create and run redpanda container: ```rust, no_run use testcontainers::runners::AsyncRunner; use testcontainers_redpanda_rs::*; - -let container = Redpanda::latest(); - -let server_node = container.start().await; -let bootstrap_servers = format!("localhost:{}", server_node.get_host_port_ipv4(REDPANDA_PORT).await); -// if topic has only one partition this part is optional -// it will be automatically created when client connects -let test_topic_name = "test_topic"; -server_node.exec(Redpanda::cmd_create_topic(test_topic_name, 3)).await; - -println!("Redpanda server: {}", bootstrap_servers); +#[tokio::main] +async fn main() { + let container = Redpanda::latest(); + + let server_node = container.start().await; + let bootstrap_servers = format!("localhost:{}", server_node.get_host_port_ipv4(REDPANDA_PORT).await); + // if topic has only one partition this part is optional + // it will be automatically created when client connects + let test_topic_name = "test_topic"; + server_node.exec(Redpanda::cmd_create_topic(test_topic_name, 3)).await; + + println!("Redpanda server: {}", bootstrap_servers); +} ``` Current limitations: diff --git a/src/lib.rs b/src/lib.rs index 59d340c..fe485de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,7 +127,9 @@ impl Image for Redpanda { } fn expose_ports(&self) -> Vec { - //vec![REDPANDA_PORT, SCHEMA_REGISTRY_PORT, ADMIN_PORT] + // this is not needed as we map it explicitly + // and testcontainer gets confused and re-map it + // vec![REDPANDA_PORT, SCHEMA_REGISTRY_PORT, ADMIN_PORT] vec![] }