Skip to content

Commit

Permalink
a minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
milenkovicm committed Nov 15, 2023
1 parent 19ca5ff commit 923c28d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ name = "testcontainers-redpanda-rs"
version = "0.1.0"
edition = "2021"
license = "MIT"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "Unofficial redpanda test container"
homepage = "http://github.com/milenkovicm/testcontainers-redpanda-rs"
repository = "http://github.com/milenkovicm/testcontainers-redpanda-rs"
readme = "README.md"
categories = ["testcontainers", "test", "kafka", "docker"]

[dependencies]
log = "0.4"
Expand Down
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2023 Marko Milenkovic

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 0 additions & 7 deletions LICENSE.md

This file was deleted.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ let docker = clients::Cli::default();
let container = Redpanda::default();

let server_node = docker.run(container);
// auto create topic is enabled
// use this to create topic with specific number
// of partitions.
server_node.exec(Redpanda::cmd_create_topic("new_topic_name", 3));
let bootstrap_servers = format!("localhost:{}", server_node.get_host_port_ipv4(REDPANDA_PORT));

println!("bootstrap servers: {}", bootstrap_servers);
```

[Have a look at tests](tests/) for more usage examples.

Current limitations:

* It will use default kafka ports and only one test can at any time on given host. It was too complicated getting it right.
18 changes: 2 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![doc = include_str!("../README.md")]

use testcontainers::{
core::{ContainerState, ExecCommand, WaitFor},
Image, ImageArgs, RunnableImage,
Expand All @@ -6,22 +8,6 @@ use testcontainers::{
pub const REDPANDA_PORT: u16 = 9092;
pub const SCHEMA_REGISTRY_PORT: u16 = 8081;

///
/// # Redpanda Test Container
///
/// It starts a `redpanda` node for testing purposes.
///
/// Under the hood it should start something like:
///
/// ```bash
/// docker run -ti --name=redpanda-1 --rm -p 9092:9092 -p 9644:9644 -p 8081:8081 docker.redpanda.com/redpandadata/redpanda redpanda start --overprovisioned --smp 1 --memory 1G --reserve-memory 0M --node-id 0 --check=false
/// ```
///
/// Current limitations:
///
/// * it will use default kafka ports and only one test can at any time on given host. It was too complicated getting it right.
///

#[derive(Debug)]
pub struct Redpanda {
tag: String,
Expand Down

0 comments on commit 923c28d

Please sign in to comment.