Skip to content

Commit 9be1db2

Browse files
test: shorten some tests (#2428)
Co-authored-by: Andrew McKnight <[email protected]>
1 parent 68094b3 commit 9be1db2

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

Tests/SentryTests/Integrations/Performance/SentryPerformanceTrackerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class SentryPerformanceTrackerTests: XCTestCase {
314314
let queue = DispatchQueue(label: "SentryPerformanceTrackerTests", attributes: [.concurrent, .initiallyInactive])
315315
let group = DispatchGroup()
316316

317-
for _ in 0 ..< 50_000 {
317+
for _ in 0 ..< 50 {
318318
group.enter()
319319
queue.async {
320320
let childId = self.startSpan(tracker: sut)

Tests/SentryTests/Performance/SentryTracerTests.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,14 @@ class SentryTracerTests: XCTestCase {
697697

698698
let queue = DispatchQueue(label: "SentryTracerTests", attributes: [.concurrent, .initiallyInactive])
699699
let group = DispatchGroup()
700-
701-
for _ in 0 ..< 5_000 {
700+
701+
let children = 5
702+
let grandchildren = 10
703+
for _ in 0 ..< children {
702704
group.enter()
703705
queue.async {
704706
let grandChild = child.startChild(operation: self.fixture.transactionOperation)
705-
for _ in 0 ..< 9 {
707+
for _ in 0 ..< grandchildren {
706708
let grandGrandChild = grandChild.startChild(operation: self.fixture.transactionOperation)
707709
grandGrandChild.finish()
708710
}
@@ -721,7 +723,7 @@ class SentryTracerTests: XCTestCase {
721723
assertOneTransactionCaptured(sut)
722724

723725
let spans = getSerializedTransaction()["spans"]! as! [[String: Any]]
724-
XCTAssertEqual(spans.count, 50_001)
726+
XCTAssertEqual(spans.count, children * (grandchildren + 1) + 1)
725727
}
726728

727729
// Although we only run this test above the below specified versions, we expect the
@@ -735,7 +737,7 @@ class SentryTracerTests: XCTestCase {
735737
let queue = DispatchQueue(label: "", qos: .background, attributes: [.concurrent, .initiallyInactive] )
736738
let group = DispatchGroup()
737739

738-
let transactions = 10_000
740+
let transactions = 5
739741
for _ in 0..<transactions {
740742
group.enter()
741743
queue.async {

Tests/SentryTests/SentryScopeSwiftTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ class SentryScopeSwiftTests: XCTestCase {
331331
group.enter()
332332
queue.async {
333333

334-
// The number is kept small for the CI to not take to long.
334+
// The number is kept small for the CI to not take too long.
335335
// If you really want to test this increase to 100_000 or so.
336-
for _ in 0...1_000 {
336+
for _ in 0...10 {
337337
// Simulate some real world modifications of the user
338338
self.modifyScope(scope: scope)
339339
}

Tests/SentryTests/TestClient.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Foundation
22

33
class TestClient: Client {
44
let sentryFileManager: SentryFileManager
5-
let queue = DispatchQueue(label: "TestClient", attributes: .concurrent)
65

76
override init?(options: Options) {
87
sentryFileManager = try! SentryFileManager(options: options, andCurrentDateProvider: TestCurrentDateProvider())

0 commit comments

Comments
 (0)