Skip to content

Commit e807e38

Browse files
Merge pull request #2882 from SwiftPackageIndex/improve-query-performance-messages
Improve wording around query performance thresholds
2 parents 82c26cf + 99ba881 commit e807e38

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Tests/AppTests/QueryPerformanceTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class QueryPerformanceTests: XCTestCase {
7171
let filter = try KeywordSearchFilter(expression: .init(operator: .is, value: "apple"))
7272
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
7373
.unwrap()
74-
try await assertQueryPerformance(query, expectedCost: 6800, variation: 200)
74+
try await assertQueryPerformance(query, expectedCost: 6900, variation: 200)
7575
}
7676

7777
func test_07_Search_query_lastActicityFilter() async throws {
@@ -92,7 +92,7 @@ class QueryPerformanceTests: XCTestCase {
9292
let filter = try PlatformSearchFilter(expression: .init(operator: .is, value: "macos,ios"))
9393
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
9494
.unwrap()
95-
try await assertQueryPerformance(query, expectedCost: 6800, variation: 200)
95+
try await assertQueryPerformance(query, expectedCost: 6900, variation: 200)
9696
}
9797

9898
func test_10_Search_query_productTypeFilter() async throws {
@@ -152,7 +152,7 @@ class QueryPerformanceTests: XCTestCase {
152152
JOIN versions v ON v.package_id = p.id
153153
WHERE v.reference ->> 'branch' = r.default_branch
154154
""")
155-
try await assertQueryPerformance(query, expectedCost: 69_000, variation: 3000)
155+
try await assertQueryPerformance(query, expectedCost: 70_000, variation: 3000)
156156
}
157157

158158
}
@@ -220,14 +220,14 @@ private extension QueryPerformanceTests {
220220
break
221221
case ..<(expectedCost + variation):
222222
if isRunningInCI {
223-
print("::warning file=\(filePath),line=\(lineNumber),title=\(testName)::Total cost of \(parsedPlan.cost.total) above threshold of \(expectedCost + variation) (within variation)")
223+
print("::warning file=\(filePath),line=\(lineNumber),title=\(testName)::Total cost of \(parsedPlan.cost.total) close to the threshold of \(expectedCost + variation)")
224224
}
225225
default:
226226
if isRunningInCI {
227-
print("::error file=\(filePath),line=\(lineNumber),title=\(testName)::Total cost of \(parsedPlan.cost.total) above threshold of \(expectedCost + variation) (incl variation)")
227+
print("::error file=\(filePath),line=\(lineNumber),title=\(testName)::Total cost of \(parsedPlan.cost.total) above the threshold of \(expectedCost + variation)")
228228
}
229229
XCTFail("""
230-
Total cost of \(parsedPlan.cost.total) above threshold of \(expectedCost + variation) (incl variation)
230+
Total cost of \(parsedPlan.cost.total) above the threshold of \(expectedCost + variation)
231231
232232
Query plan:
233233

0 commit comments

Comments
 (0)