Skip to content

Commit

Permalink
test: Disable logs for a failing metrics test (#3967)
Browse files Browse the repository at this point in the history
The test timed out in CI. Let's disable logs to speed it up.
  • Loading branch information
philipphofmann authored May 10, 2024
1 parent a0ef0af commit e072ad1
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions Tests/SentryTests/Swift/Metrics/BucketMetricsAggregatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,25 @@ final class BucketMetricsAggregatorTests: XCTestCase {
// Start the flush timer with very high interval
let sut = BucketMetricsAggregator(client: metricsClient, currentDate: currentDate, dispatchQueue: SentryDispatchQueueWrapper(), random: SentryRandom(), totalMaxWeight: 1_000, flushInterval: 0.000001, flushTolerance: 0.0)

let expectation = expectation(description: "Adding metrics")
expectation.expectedFulfillmentCount = 100

// Keep adding metrics async so the flush timer has a few chances to
// send metrics
for i in 0..<100 {
DispatchQueue.global().async {
sut.increment(key: "key\(i)", value: 1.0, unit: MeasurementUnitDuration.day, tags: [:])
currentDate.setDate(date: currentDate.date().addingTimeInterval(10.0))

expectation.fulfill()
SentryLog.withOutLogs {
let expectation = expectation(description: "Adding metrics")
expectation.expectedFulfillmentCount = 100

// Keep adding metrics async so the flush timer has a few chances to
// send metrics
for i in 0..<100 {
DispatchQueue.global().async {
sut.increment(key: "key\(i)", value: 1.0, unit: MeasurementUnitDuration.day, tags: [:])
currentDate.setDate(date: currentDate.date().addingTimeInterval(10.0))

expectation.fulfill()
}
}

wait(for: [expectation], timeout: 1.0)

expect(metricsClient.captureInvocations.count).to(beGreaterThan(0), description: "Repeating flush timer should send some metrics.")
}

wait(for: [expectation], timeout: 1.0)

expect(metricsClient.captureInvocations.count).to(beGreaterThan(0), description: "Repeating flush timer should send some metrics.")
}

func testClose_InvalidatesTimer() throws {
Expand Down

0 comments on commit e072ad1

Please sign in to comment.