File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,15 @@ const TAG: &str = "3.8.0";
1616pub const KAFKA_PORT : ContainerPort = ContainerPort :: Tcp ( 9092 ) ;
1717
1818const START_SCRIPT : & str = "/opt/kafka/testcontainers_start.sh" ;
19- const DEFAULT_INTERNAL_TOPIC_RF : usize = 1 ;
20- const DEFAULT_CLUSTER_ID : & str = "5L6g3nShT-eMCtK--X86sw" ;
21- const DEFAULT_BROKER_ID : usize = 1 ;
19+
20+ /// The default Replication Factor to use.
21+ pub const DEFAULT_INTERNAL_TOPIC_RF : usize = 1 ;
22+
23+ /// The default cluster id to use.
24+ pub const DEFAULT_CLUSTER_ID : & str = "5L6g3nShT-eMCtK--X86sw" ;
25+
26+ /// The default broker id.
27+ pub const DEFAULT_BROKER_ID : usize = 1 ;
2228
2329/// Module to work with [`Apache Kafka`] broker
2430///
Original file line number Diff line number Diff line change @@ -18,6 +18,15 @@ pub const KAFKA_PORT: ContainerPort = ContainerPort::Tcp(9093);
1818/// [`Zookeeper`]: https://zookeeper.apache.org/
1919pub const ZOOKEEPER_PORT : ContainerPort = ContainerPort :: Tcp ( 2181 ) ;
2020
21+ /// The default Replication Factor to use.
22+ pub const DEFAULT_INTERNAL_TOPIC_RF : usize = 1 ;
23+
24+ /// The default cluster id to use.
25+ pub const DEFAULT_CLUSTER_ID : & str = "5L6g3nShT-eMCtK--X86sw" ;
26+
27+ /// The default broker id.
28+ pub const DEFAULT_BROKER_ID : usize = 1 ;
29+
2130/// Module to work with [`Apache Kafka`] inside of tests.
2231///
2332/// Starts an instance of Kafka based on the official [`Confluent Kafka docker image`].
@@ -80,11 +89,12 @@ impl Default for Kafka {
8089 port = KAFKA_PORT . as_u16( ) ,
8190 ) ,
8291 ) ;
83- env_vars. insert ( "KAFKA_BROKER_ID" . to_owned ( ) , "1" . to_owned ( ) ) ;
92+ env_vars. insert ( "KAFKA_BROKER_ID" . to_owned ( ) , DEFAULT_BROKER_ID . to_string ( ) ) ;
8493 env_vars. insert (
8594 "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR" . to_owned ( ) ,
86- "1" . to_owned ( ) ,
95+ DEFAULT_INTERNAL_TOPIC_RF . to_string ( ) ,
8796 ) ;
97+ env_vars. insert ( "CLUSTER_ID" . to_owned ( ) , DEFAULT_CLUSTER_ID . to_owned ( ) ) ;
8898
8999 Self { env_vars }
90100 }
You can’t perform that action at this time.
0 commit comments