Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
lovetodream committed Apr 21, 2024
1 parent cce4af8 commit e9ce7cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
4 changes: 2 additions & 2 deletions Tests/LoggingLokiTests/LokiLogProcessorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]"#)
}
}

0 comments on commit e9ce7cf

Please sign in to comment.