Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(zookeper): use bitnami image #33

Merged
merged 1 commit into from
Sep 25, 2023
Merged
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 src/dynamodb_local/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use testcontainers::{core::WaitFor, Image};

const NAME: &str = "amazon/dynamodb-local";
const TAG: &str = "latest";
const DEFAULT_WAIT: u64 = 2000;
const TAG: &str = "2.0.0";
const DEFAULT_WAIT: u64 = 3000;

#[derive(Default, Debug)]
pub struct DynamoDb;
Expand Down
33 changes: 26 additions & 7 deletions src/zookeeper/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
use std::collections::HashMap;

use testcontainers::{core::WaitFor, Image};

const NAME: &str = "zookeeper";
const TAG: &str = "3.6.2";
const NAME: &str = "bitnami/zookeeper";
const TAG: &str = "3.9.0";

#[derive(Debug)]
pub struct Zookeeper {
env_vars: HashMap<String, String>,
}

impl Default for Zookeeper {
fn default() -> Self {
let mut env_vars = HashMap::new();
env_vars.insert("ALLOW_ANONYMOUS_LOGIN".to_owned(), "yes".to_owned());

#[derive(Debug, Default)]
pub struct Zookeeper;
Self { env_vars }
}
}

impl Image for Zookeeper {
type Args = ();
Expand All @@ -18,7 +31,14 @@ impl Image for Zookeeper {
}

fn ready_conditions(&self) -> Vec<WaitFor> {
vec![WaitFor::message_on_stdout("Started AdminServer")]
vec![
WaitFor::message_on_stdout("Started AdminServer"),
WaitFor::message_on_stdout("PrepRequestProcessor (sid:0) started"),
]
}

fn env_vars(&self) -> Box<dyn Iterator<Item = (&String, &String)> + '_> {
Box::new(self.env_vars.iter())
}
}

Expand All @@ -32,12 +52,11 @@ mod tests {
use crate::zookeeper::Zookeeper as ZookeeperImage;

#[test]
#[ignore]
fn zookeeper_check_directories_existence() {
let _ = pretty_env_logger::try_init();

let docker = clients::Cli::default();
let node = docker.run(ZookeeperImage);
let node = docker.run(ZookeeperImage::default());

let host_port = node.get_host_port_ipv4(2181);
let zk_urls = format!("127.0.0.1:{host_port}");
Expand Down
Loading