Skip to content

Commit

Permalink
test: shorten some tests (#2428)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew McKnight <andrew.mcknight@sentry.io>
  • Loading branch information
philipphofmann and armcknight authored Nov 22, 2022
1 parent 68094b3 commit 9be1db2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class SentryPerformanceTrackerTests: XCTestCase {
let queue = DispatchQueue(label: "SentryPerformanceTrackerTests", attributes: [.concurrent, .initiallyInactive])
let group = DispatchGroup()

for _ in 0 ..< 50_000 {
for _ in 0 ..< 50 {
group.enter()
queue.async {
let childId = self.startSpan(tracker: sut)
Expand Down
12 changes: 7 additions & 5 deletions Tests/SentryTests/Performance/SentryTracerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -697,12 +697,14 @@ class SentryTracerTests: XCTestCase {

let queue = DispatchQueue(label: "SentryTracerTests", attributes: [.concurrent, .initiallyInactive])
let group = DispatchGroup()

for _ in 0 ..< 5_000 {

let children = 5
let grandchildren = 10
for _ in 0 ..< children {
group.enter()
queue.async {
let grandChild = child.startChild(operation: self.fixture.transactionOperation)
for _ in 0 ..< 9 {
for _ in 0 ..< grandchildren {
let grandGrandChild = grandChild.startChild(operation: self.fixture.transactionOperation)
grandGrandChild.finish()
}
Expand All @@ -721,7 +723,7 @@ class SentryTracerTests: XCTestCase {
assertOneTransactionCaptured(sut)

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

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

let transactions = 10_000
let transactions = 5
for _ in 0..<transactions {
group.enter()
queue.async {
Expand Down
4 changes: 2 additions & 2 deletions Tests/SentryTests/SentryScopeSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ class SentryScopeSwiftTests: XCTestCase {
group.enter()
queue.async {

// The number is kept small for the CI to not take to long.
// The number is kept small for the CI to not take too long.
// If you really want to test this increase to 100_000 or so.
for _ in 0...1_000 {
for _ in 0...10 {
// Simulate some real world modifications of the user
self.modifyScope(scope: scope)
}
Expand Down
1 change: 0 additions & 1 deletion Tests/SentryTests/TestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Foundation

class TestClient: Client {
let sentryFileManager: SentryFileManager
let queue = DispatchQueue(label: "TestClient", attributes: .concurrent)

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

0 comments on commit 9be1db2

Please sign in to comment.