diff --git a/src/client/partition.rs b/src/client/partition.rs index f4f40b49..c8a462fc 100644 --- a/src/client/partition.rs +++ b/src/client/partition.rs @@ -101,6 +101,16 @@ impl PartitionClient { } } + /// Topic + pub fn topic(&self) -> &str { + &self.topic + } + + /// Partition + pub fn partition(&self) -> i32 { + self.partition + } + /// Produce a batch of records to the partition pub async fn produce( &self, diff --git a/tests/client.rs b/tests/client.rs index 45d9d9e4..8871858c 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -70,6 +70,26 @@ async fn test_topic_crud() { } } +#[tokio::test] +async fn test_partition_client() { + maybe_start_logging(); + + let connection = maybe_skip_kafka_integration!(); + let topic_name = random_topic_name(); + + let client = ClientBuilder::new(connection).build().await.unwrap(); + + let controller_client = client.controller_client().unwrap(); + controller_client + .create_topic(&topic_name, 1, 1, 5_000) + .await + .unwrap(); + + let partition_client = client.partition_client(topic_name.clone(), 0).unwrap(); + assert_eq!(partition_client.topic(), &topic_name); + assert_eq!(partition_client.partition(), 0); +} + // Disabled as currently no TLS integration tests #[ignore] #[tokio::test]