diff --git a/Tests/Segment-Tests/Telemetry_Tests.swift b/Tests/Segment-Tests/Telemetry_Tests.swift index 9097fbd..ed0cc0e 100644 --- a/Tests/Segment-Tests/Telemetry_Tests.swift +++ b/Tests/Segment-Tests/Telemetry_Tests.swift @@ -143,6 +143,39 @@ class TelemetryTests: XCTestCase { Telemetry.shared.error(metric: Telemetry.INVOKE_ERROR_METRIC, log: longString) { $0["writekey"] = longString } XCTAssertTrue(Telemetry.shared.queue.count < 1000) } + + func testConcurrentErrorReporting() { + Telemetry.shared.enable = true + Telemetry.shared.start() + let operationCount = 200 + + var concurrentExpectation = XCTestExpectation(description: "High pressure operations") + concurrentExpectation.expectedFulfillmentCount = operationCount + + // Use multiple dispatch queues to increase concurrency + let queues = [ + DispatchQueue.global(qos: .userInitiated), + DispatchQueue.global(qos: .default), + DispatchQueue.global(qos: .utility) + ] + for i in 0..