File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,16 @@ impl PartitionClient {
101
101
}
102
102
}
103
103
104
+ /// Topic
105
+ pub fn topic ( & self ) -> & str {
106
+ & self . topic
107
+ }
108
+
109
+ /// Partition
110
+ pub fn partition ( & self ) -> i32 {
111
+ self . partition
112
+ }
113
+
104
114
/// Produce a batch of records to the partition
105
115
pub async fn produce (
106
116
& self ,
Original file line number Diff line number Diff line change @@ -70,6 +70,26 @@ async fn test_topic_crud() {
70
70
}
71
71
}
72
72
73
+ #[ tokio:: test]
74
+ async fn test_partition_client ( ) {
75
+ maybe_start_logging ( ) ;
76
+
77
+ let connection = maybe_skip_kafka_integration ! ( ) ;
78
+ let topic_name = random_topic_name ( ) ;
79
+
80
+ let client = ClientBuilder :: new ( connection) . build ( ) . await . unwrap ( ) ;
81
+
82
+ let controller_client = client. controller_client ( ) . unwrap ( ) ;
83
+ controller_client
84
+ . create_topic ( & topic_name, 1 , 1 , 5_000 )
85
+ . await
86
+ . unwrap ( ) ;
87
+
88
+ let partition_client = client. partition_client ( topic_name. clone ( ) , 0 ) . unwrap ( ) ;
89
+ assert_eq ! ( partition_client. topic( ) , & topic_name) ;
90
+ assert_eq ! ( partition_client. partition( ) , 0 ) ;
91
+ }
92
+
73
93
// Disabled as currently no TLS integration tests
74
94
#[ ignore]
75
95
#[ tokio:: test]
You can’t perform that action at this time.
0 commit comments