Skip to content

Commit

Permalink
RUMM-824 Fix benchmark tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ncreated committed Jan 5, 2021
1 parent d6fe8b0 commit 92e2750
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Tests/DatadogBenchmarkTests/BenchmarkMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ private struct DateCorrectorMock: DateCorrectorType {
}
}

extension PerformancePreset {
static let benchmarksPreset = PerformancePreset(batchSize: .small, uploadFrequency: .frequent, bundleType: .iOSApp)
}

extension FeaturesCommonDependencies {
static func mockAny() -> Self {
return .init(
consentProvider: ConsentProvider(initialConsent: .granted),
performance: .default,
performance: .benchmarksPreset,
httpClient: HTTPClient(),
mobileDevice: .current,
dateProvider: SystemDateProvider(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LoggingStorageBenchmarkTests: XCTestCase {
}

// Wait enough time for `reader` to accept the youngest batch file
Thread.sleep(forTimeInterval: PerformancePreset.default.minFileAgeForRead + 0.1)
Thread.sleep(forTimeInterval: PerformancePreset.benchmarksPreset.minFileAgeForRead + 0.1)

measureMetrics([.wallClockTime], automaticallyStartMeasuring: false) {
self.startMeasuring()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RUMStorageBenchmarkTests: XCTestCase {
}

// Wait enough time for `reader` to accept the youngest batch file
Thread.sleep(forTimeInterval: PerformancePreset.default.minFileAgeForRead + 0.1)
Thread.sleep(forTimeInterval: PerformancePreset.benchmarksPreset.minFileAgeForRead + 0.1)

measureMetrics([.wallClockTime], automaticallyStartMeasuring: false) {
self.startMeasuring()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TracingStorageBenchmarkTests: XCTestCase {
}

// Wait enough time for `reader` to accept the youngest batch file
Thread.sleep(forTimeInterval: PerformancePreset.default.minFileAgeForRead + 0.1)
Thread.sleep(forTimeInterval: PerformancePreset.benchmarksPreset.minFileAgeForRead + 0.1)

measureMetrics([.wallClockTime], automaticallyStartMeasuring: false) {
self.startMeasuring()
Expand Down

0 comments on commit 92e2750

Please sign in to comment.