use std::borrow::Cow;
use testcontainers::{
core::{ContainerPort, WaitFor},
Image,
};
const NAME: &str = "docker.elastic.co/elasticsearch/elasticsearch";
const TAG: &str = "7.16.1";
pub const ELASTICSEARCH_API_PORT: ContainerPort = ContainerPort::Tcp(9200);
pub const ELASTICSEARCH_INTER_NODE_PORT: ContainerPort = ContainerPort::Tcp(9300);
#[allow(missing_docs)]
#[derive(Debug, Default, Clone)]
pub struct ElasticSearch {
_priv: (),
}
impl Image for ElasticSearch {
fn name(&self) -> &str {
NAME
}
fn tag(&self) -> &str {
TAG
}
fn ready_conditions(&self) -> Vec<WaitFor> {
vec![WaitFor::message_on_stdout("[YELLOW] to [GREEN]")]
}
fn env_vars(
&self,
) -> impl IntoIterator<Item = (impl Into<Cow<'_, str>>, impl Into<Cow<'_, str>>)> {
[("discovery.type", "single-node")]
}
fn expose_ports(&self) -> &[ContainerPort] {
&[ELASTICSEARCH_API_PORT, ELASTICSEARCH_INTER_NODE_PORT]
}
}
#[cfg(test)]
mod tests {}