From e9ce7cfde4bb24748895a88d0ca6dbb7258f1728 Mon Sep 17 00:00:00 2001 From: Timo <38291523+lovetodream@users.noreply.github.com> Date: Sun, 21 Apr 2024 18:17:06 +0200 Subject: [PATCH] fix: test --- .../LoggingLokiTests/LokiLogProcessorConfigurationTests.swift | 2 +- Tests/LoggingLokiTests/LokiLogProcessorTests.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift b/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift index f7b9f6c..55ebf3c 100644 --- a/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift +++ b/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift @@ -9,7 +9,7 @@ final class LokiLogProcessorConfigurationTests: XCTestCase { XCTAssertEqual(configuration1._lokiURL, "http://localhost:3200/loki/api/v1/push") configuration1.lokiURL = "http://localhost:3300" XCTAssertEqual(configuration1._lokiURL, "http://localhost:3300/loki/api/v1/push") - var configuration2 = LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100/") + let configuration2 = LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100/") XCTAssertEqual(configuration2._lokiURL, "http://localhost:3100/loki/api/v1/push") } } diff --git a/Tests/LoggingLokiTests/LokiLogProcessorTests.swift b/Tests/LoggingLokiTests/LokiLogProcessorTests.swift index d927696..118040b 100644 --- a/Tests/LoggingLokiTests/LokiLogProcessorTests.swift +++ b/Tests/LoggingLokiTests/LokiLogProcessorTests.swift @@ -26,7 +26,7 @@ final class LokiLogProcessorTests: XCTestCase { let configuration = LokiLogProcessorConfiguration( lokiURL: "http://localhost:3100", metadataFormat: .custom({ level, message, metadata in - "\(level.rawValue.uppercased()): \(message) \(metadata)" + "\(level.rawValue.uppercased()): \(message) [\(metadata.sorted(by: { $0.key < $1.key }).map({ "\($0.key): \($0.value)" }).joined(separator: ", "))]" }) ) let processor = LokiLogProcessor(configuration: configuration) @@ -38,6 +38,6 @@ final class LokiLogProcessorTests: XCTestCase { ) let formatted = processor.makeLog(raw) XCTAssertNil(formatted.metadata) - XCTAssertEqual(formatted.line, #"INFO: My log message ["basic_key": basic_value, "additional_key": value with whitespace]"#) + XCTAssertEqual(formatted.line, #"INFO: My log message [additional_key: value with whitespace, basic_key: basic_value]"#) } }