17 releases (9 breaking)

0.10.2 Feb 10, 2025
0.10.1 Nov 26, 2024
0.10.0 Sep 26, 2024
0.7.0 Jul 31, 2024
0.1.1 Nov 15, 2023

#351 in Testing

Download history 1/week @ 2024-10-29 1/week @ 2024-11-05 3/week @ 2024-11-19 129/week @ 2024-11-26 15/week @ 2024-12-03 20/week @ 2024-12-10 10/week @ 2024-12-17 1/week @ 2025-01-07 2/week @ 2025-01-21 22/week @ 2025-01-28 95/week @ 2025-02-04 92/week @ 2025-02-11

211 downloads per month

MIT license

25KB
87 lines

Unofficial Rust Test Container For Redpanda

github action Crates.io Crates.io

Unofficial testcontainer for Redpanda. Redpanda is a simple, powerful, and cost-efficient streaming data platform that is compatible with Kafka APIs but much less complex, faster and more affordable.

Add dependency:

testcontainers-redpanda-rs = { version = "0.10" }

Create and run redpanda container:

use testcontainers_redpanda_rs::*;

#[tokio::main]
async fn main() {
    let container = Redpanda::default();

    let server_node = container.start().await.unwrap();
    let bootstrap_servers = format!("localhost:{}", server_node.get_host_port_ipv4(REDPANDA_PORT).await.unwrap());
    // if topic has only one partition this part is optional
    // it will be automatically created when client connects
    server_node.exec(Redpanda::cmd_create_topic("test_topic", 3)).await.unwrap();

    println!("Redpanda server: {}", bootstrap_servers);
}

Explicit dependency on testcontainers is not needed.

Note about version compatibility:

  • 0.10.x supports testcontainers 0.23
  • 0.9.x supports testcontainers 0.22
  • 0.8.x supports testcontainers 0.21
  • 0.7.x supports testcontainers 0.21
  • 0.6.x supports testcontainers 0.20
  • 0.5.x supports testcontainers 0.19
  • 0.4.x supports testcontainers 0.18
  • 0.3.x supports testcontainers 0.17
  • 0.2.x supports testcontainers 0.16
  • 0.1.x supports testcontainers 0.15

Dependencies

~22–37MB
~677K SLoC