From d40987920a739e11a6f1d59ff106712c580030f6 Mon Sep 17 00:00:00 2001 From: Romain Gallet Date: Mon, 29 Apr 2024 23:47:25 +0200 Subject: [PATCH] Fixed test comparing raw outputs (#61) Fixed test comparing raw outputs (#61) --- src/sink.rs | 6 ++---- src/sink/console_tests.rs | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/sink.rs b/src/sink.rs index 92e56af..a01c675 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -311,11 +311,9 @@ where let partition_key = if self.get_config().print_key { let key = record_result.partition_key.to_string(); - let key = self.write_key(&key); - - format!("{} ", key) + Metadata::content(self.write_key(&key)) } else { - "".to_string() + Metadata::Empty }; let sequence_number = if self.get_config().print_sequence_number { diff --git a/src/sink/console_tests.rs b/src/sink/console_tests.rs index b9cf38b..2f51bd6 100644 --- a/src/sink/console_tests.rs +++ b/src/sink/console_tests.rs @@ -123,8 +123,7 @@ fn format_outputs_raw() { }; let vec = console.format_record(&record); - let result = String::from_utf8_lossy(vec.as_slice()); - assert_eq!(result, "Hello �World\n"); + assert_eq!(vec, b"Hello \xF0\x90\x80World\n"); } #[tokio::test]