Skip to content

Commit

Permalink
refactor(zookeper): use bitnami image (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
DDtKey committed Sep 25, 2023
1 parent 062cbc5 commit 9ee9d98
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
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

0 comments on commit 9ee9d98

Please sign in to comment.