1
- use std:: sync:: Arc ;
1
+ use std:: { sync:: Arc , time :: Duration } ;
2
2
3
3
use rskafka:: {
4
4
client:: {
@@ -260,8 +260,16 @@ async fn assert_produce_consume<F1, G1, F2, G2>(
260
260
. unwrap ( ) ;
261
261
let partition_client = Arc :: new ( client. partition_client ( topic_name. clone ( ) , 1 ) . unwrap ( ) ) ;
262
262
263
+ // timestamps for records. We'll reorder the messages though to ts2, ts1, ts3
264
+ let ts1 = now ( ) ;
265
+ let ts2 = ts1 + Duration :: from_millis ( 1 ) ;
266
+ let ts3 = ts2 + Duration :: from_millis ( 1 ) ;
267
+
263
268
let record_1 = {
264
- let record = record ( b"" ) ;
269
+ let record = Record {
270
+ timestamp : ts2,
271
+ ..record ( b"" )
272
+ } ;
265
273
match compression {
266
274
Compression :: NoCompression => record,
267
275
#[ allow( unreachable_patterns) ]
@@ -277,12 +285,12 @@ async fn assert_produce_consume<F1, G1, F2, G2>(
277
285
} ;
278
286
let record_2 = Record {
279
287
value : Some ( b"some value" . to_vec ( ) ) ,
280
- timestamp : now ( ) ,
288
+ timestamp : ts1 ,
281
289
..record_1. clone ( )
282
290
} ;
283
291
let record_3 = Record {
284
292
value : Some ( b"more value" . to_vec ( ) ) ,
285
- timestamp : now ( ) ,
293
+ timestamp : ts3 ,
286
294
..record_1. clone ( )
287
295
} ;
288
296
@@ -322,7 +330,11 @@ async fn assert_produce_consume<F1, G1, F2, G2>(
322
330
. zip ( [ record_1, record_2, record_3] )
323
331
. map ( |( offset, record) | RecordAndOffset { record, offset } )
324
332
. collect ( ) ;
325
- assert_eq ! ( actual, expected) ;
333
+ assert_eq ! (
334
+ actual, expected,
335
+ "Records are different.\n \n Actual:\n {:#?}\n \n Expected:\n {:#?}" ,
336
+ actual, expected,
337
+ ) ;
326
338
}
327
339
328
340
async fn produce_java (
0 commit comments