Skip to content

Commit 9100f1f

Browse files
Revert "test: Use XCTestExpectation in PerformanceTracker (getsentry#5830)"
This reverts commit 93c4d68.
1 parent 9ffb91b commit 9100f1f

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

Tests/SentryTests/Integrations/Performance/SentryPerformanceTrackerTests.swift

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -287,21 +287,18 @@ class SentryPerformanceTrackerTests: XCTestCase {
287287
sut.activateSpan(spanId) {
288288

289289
let queue = DispatchQueue(label: "SentryPerformanceTrackerTests", attributes: [.concurrent, .initiallyInactive])
290+
let group = DispatchGroup()
290291

291-
let loopCount = 5_000
292-
let expectation = self.expectation(description: "Start spans in parallel")
293-
expectation.expectedFulfillmentCount = loopCount
294-
expectation.assertForOverFulfill = true
295-
296-
for _ in 0 ..< loopCount {
292+
for _ in 0 ..< 5_000 {
293+
group.enter()
297294
queue.async {
298295
_ = self.startSpan(tracker: sut)
299-
expectation.fulfill()
296+
group.leave()
300297
}
301298
}
302299

303300
queue.activate()
304-
self.wait(for: [expectation], timeout: 10.0)
301+
group.wait()
305302
}
306303
let spans = getSpans(tracker: sut)
307304
XCTAssertEqual(spans.count, 5_001)
@@ -316,23 +313,20 @@ class SentryPerformanceTrackerTests: XCTestCase {
316313
sut.activateSpan(spanId) {
317314

318315
let queue = DispatchQueue(label: "SentryPerformanceTrackerTests", attributes: [.concurrent, .initiallyInactive])
319-
320-
let loopCount = 50
321-
let expectation = self.expectation(description: "Create child spans in parallel")
322-
expectation.expectedFulfillmentCount = loopCount
323-
expectation.assertForOverFulfill = true
324-
325-
for _ in 0 ..< loopCount {
316+
let group = DispatchGroup()
317+
318+
for _ in 0 ..< 50 {
319+
group.enter()
326320
queue.async {
327321
let childId = self.startSpan(tracker: sut)
328322
sut.activateSpan(childId) {
329323
}
330-
expectation.fulfill()
324+
group.leave()
331325
}
332326
}
333327

334328
queue.activate()
335-
self.wait(for: [expectation], timeout: 10.0)
329+
group.wait()
336330
}
337331

338332
let stack = getStack(tracker: sut)

0 commit comments

Comments
 (0)