From a6c470b01367f1f2820b13dfaacd0ef92a0f6d24 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Fri, 8 Aug 2025 08:34:58 +0200 Subject: [PATCH] test: Use XCTestExpectation for User Replace the dispatch group with an XCTestExpectation to get a failure message when the wait times out. Contributes to GH-5789 --- Tests/SentryTests/Protocol/SentryUserTests.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Tests/SentryTests/Protocol/SentryUserTests.swift b/Tests/SentryTests/Protocol/SentryUserTests.swift index 604e9bf2581..e8e68d7ad59 100644 --- a/Tests/SentryTests/Protocol/SentryUserTests.swift +++ b/Tests/SentryTests/Protocol/SentryUserTests.swift @@ -157,12 +157,15 @@ class SentryUserTests: XCTestCase { func testModifyingFromMultipleThreads() throws { let queue = DispatchQueue(label: "SentryUserTests", qos: .userInteractive, attributes: [.concurrent, .initiallyInactive]) - let group = DispatchGroup() + + let loopCount = 20 + let expectation = XCTestExpectation(description: "ModifyingFromMultipleThreads") + expectation.expectedFulfillmentCount = loopCount + expectation.assertForOverFulfill = true let user = try XCTUnwrap(TestData.user.copy() as? User) - for i in 0...20 { - group.enter() + for i in 0..