Skip to content

Commit 9082c8d

Browse files
evil159github-actions[bot]
authored andcommitted
Reduce amount of iterations in geojson update integration test (#3286)
Decrease amount of iterations from 90 to 3(one run for each add, update, delete operations) for GeoJSON update integration test. Historically this test also doubled as a benchmark hence the number of iterations, but since we don't use that data it's safe to reduce the number of iterations. cc @mapbox/sdk-ci GitOrigin-RevId: fd9e14bd6ff9351316cd3005d5db546ba603b8de
1 parent 897e25a commit 9082c8d

File tree

1 file changed

+19
-40
lines changed

1 file changed

+19
-40
lines changed

Tests/MapboxMapsTests/Integration Tests/Style/GeoJSONUpdateIntegrationTests.swift

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -53,42 +53,6 @@ class GeoJSONUpdateIntegrationTests: MapViewIntegrationTestCase {
5353
self.sourceLoadedToken = nil
5454
}
5555

56-
func benchmarkGeoJSONUpdate() {
57-
let updateExpectation = self.expectation(description: "Wait for GeoJSON to be updated")
58-
59-
mapView.mapboxMap.onSourceDataLoaded.observe { event in
60-
guard event.sourceId == Self.sourceId, event.dataId == Self.dataId else {
61-
return
62-
}
63-
64-
updateExpectation.fulfill()
65-
}.store(in: &cancelables)
66-
67-
switch parameter.updateType {
68-
case .partial:
69-
performPartialGeoJSONUpdate(operationalFeatures)
70-
case .full:
71-
performFullGeoJSONUpdate(operationalFeatures)
72-
}
73-
74-
wait(for: [updateExpectation], timeout: 10)
75-
}
76-
77-
func measureOnceIgnoringWarmUpIteration(_ block: () -> Void) {
78-
var warmUpIgnored = false
79-
let options = XCTMeasureOptions()
80-
options.iterationCount = 1
81-
82-
measure(options: options) {
83-
guard warmUpIgnored else {
84-
warmUpIgnored = true
85-
return
86-
}
87-
88-
block()
89-
}
90-
}
91-
9256
struct TestParameters {
9357
// swiftlint:disable:next nesting
9458
enum UpdateType: String {
@@ -121,8 +85,8 @@ class GeoJSONUpdateIntegrationTests: MapViewIntegrationTestCase {
12185
}
12286
}
12387
static let parameters: [TestParameters] = {
124-
let initialFeatureSizes: [Int] = [100, 1_000, 10_000, 50_000, 100_000]
125-
let operationalFeatureSizes: [Int] = [1, 100, 1_000, 10_000, 50_000, 100_000]
88+
let initialFeatureSizes: [Int] = [100]
89+
let operationalFeatureSizes: [Int] = [1]
12690

12791
let iterations = 1
12892
return (0..<iterations).flatMap { _ in
@@ -171,9 +135,24 @@ class GeoJSONUpdateIntegrationTests: MapViewIntegrationTestCase {
171135
}
172136

173137
@objc private func executeTest() {
174-
measureOnceIgnoringWarmUpIteration {
175-
benchmarkGeoJSONUpdate()
138+
let updateExpectation = self.expectation(description: "Wait for GeoJSON to be updated")
139+
140+
mapView.mapboxMap.onSourceDataLoaded.observe { event in
141+
guard event.sourceId == Self.sourceId, event.dataId == Self.dataId else {
142+
return
143+
}
144+
145+
updateExpectation.fulfill()
146+
}.store(in: &cancelables)
147+
148+
switch parameter.updateType {
149+
case .partial:
150+
performPartialGeoJSONUpdate(operationalFeatures)
151+
case .full:
152+
performFullGeoJSONUpdate(operationalFeatures)
176153
}
154+
155+
wait(for: [updateExpectation], timeout: 10)
177156
}
178157

179158
func performPartialGeoJSONUpdate(_ features: [Feature]) {

0 commit comments

Comments
 (0)