Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: shorten some tests #2422

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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