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: Disable logs for a failing metrics test #3967

Merged
merged 1 commit into from
May 10, 2024
Merged
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 @@ -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
Loading