Skip to content

Commit

Permalink
update documentation and README
Browse files Browse the repository at this point in the history
  • Loading branch information
milenkovicm committed Apr 29, 2024
1 parent 8d69b11 commit 4914d6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ impl Image for Redpanda {
}

fn expose_ports(&self) -> Vec<u16> {
//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![]
}

Expand Down

0 comments on commit 4914d6a

Please sign in to comment.