Skip to content

Commit 9935ae3

Browse files
Merge pull request #3283 from SwiftPackageIndex/maintenance-updates
Maintenance updates
2 parents d58e33a + 8de9740 commit 9935ae3

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

Tests/AppTests/QueryPerformanceTests.swift

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import XCTest
2222
class QueryPerformanceTests: XCTestCase {
2323
var app: Application!
2424

25+
// Set this to true when running locally to convert warnings to test failures for easier updating of values.
26+
static let failOnWarning = false
27+
2528
override func setUp() async throws {
2629
try await super.setUp()
2730

@@ -46,67 +49,67 @@ class QueryPerformanceTests: XCTestCase {
4649

4750
func test_02_Search_keywordMatchQuery() async throws {
4851
let query = Search.keywordMatchQueryBuilder(on: app.db, terms: ["a"])
49-
try await assertQueryPerformance(query, expectedCost: 5800, variation: 200)
52+
try await assertQueryPerformance(query, expectedCost: 5900, variation: 200)
5053
}
5154

5255
func test_03_Search_authorMatchQuery() async throws {
5356
let query = Search.authorMatchQueryBuilder(on: app.db, terms: ["a"])
54-
try await assertQueryPerformance(query, expectedCost: 1000, variation: 50)
57+
try await assertQueryPerformance(query, expectedCost: 1100, variation: 50)
5558
}
5659

5760
func test_04_Search_query_noFilter() async throws {
5861
let query = try Search.query(app.db, ["a"], page: 1)
5962
.unwrap()
60-
try await assertQueryPerformance(query, expectedCost: 8000, variation: 200)
63+
try await assertQueryPerformance(query, expectedCost: 8100, variation: 200)
6164
}
6265

6366
func test_05_Search_query_authorFilter() async throws {
6467
let filter = try AuthorSearchFilter(expression: .init(operator: .is, value: "apple"))
6568
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
6669
.unwrap()
67-
try await assertQueryPerformance(query, expectedCost: 7600, variation: 200)
70+
try await assertQueryPerformance(query, expectedCost: 7700, variation: 200)
6871
}
6972

7073
func test_06_Search_query_keywordFilter() async throws {
7174
let filter = try KeywordSearchFilter(expression: .init(operator: .is, value: "apple"))
7275
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
7376
.unwrap()
74-
try await assertQueryPerformance(query, expectedCost: 7700, variation: 200)
77+
try await assertQueryPerformance(query, expectedCost: 7800, variation: 200)
7578
}
7679

7780
func test_07_Search_query_lastActicityFilter() async throws {
7881
let filter = try LastActivitySearchFilter(expression: .init(operator: .greaterThan, value: "2000-01-01"))
7982
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
8083
.unwrap()
81-
try await assertQueryPerformance(query, expectedCost: 8000, variation: 200)
84+
try await assertQueryPerformance(query, expectedCost: 8100, variation: 200)
8285
}
8386

8487
func test_08_Search_query_licenseFilter() async throws {
8588
let filter = try LicenseSearchFilter(expression: .init(operator: .is, value: "mit"))
8689
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
8790
.unwrap()
88-
try await assertQueryPerformance(query, expectedCost: 7900, variation: 200)
91+
try await assertQueryPerformance(query, expectedCost: 8000, variation: 200)
8992
}
9093

9194
func test_09_Search_query_platformFilter() async throws {
9295
let filter = try PlatformSearchFilter(expression: .init(operator: .is, value: "macos,ios"))
9396
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
9497
.unwrap()
95-
try await assertQueryPerformance(query, expectedCost: 7800, variation: 200)
98+
try await assertQueryPerformance(query, expectedCost: 7900, variation: 200)
9699
}
97100

98101
func test_10_Search_query_productTypeFilter() async throws {
99102
let filter = try ProductTypeSearchFilter(expression: .init(operator: .is, value: "plugin"))
100103
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
101104
.unwrap()
102-
try await assertQueryPerformance(query, expectedCost: 7600, variation: 200)
105+
try await assertQueryPerformance(query, expectedCost: 7700, variation: 200)
103106
}
104107

105108
func test_11_Search_query_starsFilter() async throws {
106109
let filter = try StarsSearchFilter(expression: .init(operator: .greaterThan, value: "5"))
107110
let query = try Search.query(app.db, ["a"], filters: [filter], page: 1)
108111
.unwrap()
109-
try await assertQueryPerformance(query, expectedCost: 7800, variation: 300)
112+
try await assertQueryPerformance(query, expectedCost: 7900, variation: 300)
110113
}
111114

112115
func test_12_Search_refresh() async throws {
@@ -152,7 +155,7 @@ class QueryPerformanceTests: XCTestCase {
152155
JOIN versions v ON v.package_id = p.id
153156
WHERE v.reference ->> 'branch' = r.default_branch
154157
""")
155-
try await assertQueryPerformance(query, expectedCost: 87_000, variation: 5000)
158+
try await assertQueryPerformance(query, expectedCost: 91_000, variation: 5000)
156159
}
157160

158161
}
@@ -205,7 +208,15 @@ private extension QueryPerformanceTests {
205208
if parsedPlan.cost.total <= expectedCost {
206209
print("ℹ️ COST: \(parsedPlan.cost.total)")
207210
} else {
208-
print("⚠️ COST: \(parsedPlan.cost.total)")
211+
if Self.failOnWarning {
212+
XCTFail("""
213+
Total cost of \(parsedPlan.cost.total) above the expected cost of \(expectedCost)
214+
""",
215+
file: filePath,
216+
line: lineNumber)
217+
} else {
218+
print("⚠️ COST: \(parsedPlan.cost.total)")
219+
}
209220
}
210221
print("ℹ️ EXPECTED: \(expectedCost) ± \(variation)")
211222
print("ℹ️ ACTUAL TIME: \(parsedPlan.actualTime.total)ms")

mon.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020

2121
grafana:
2222
# https://github.com/grafana/grafana/releases
23-
image: grafana/grafana:11.1.0
23+
image: grafana/grafana:11.1.3
2424
environment:
2525
GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD}
2626
GF_USERS_ALLOW_SIGN_UP: 'false'
@@ -42,7 +42,7 @@ services:
4242

4343
loki:
4444
# https://github.com/grafana/loki/releases
45-
image: grafana/loki:3.1.0
45+
image: grafana/loki:3.1.1
4646
command: -config.file=/loki.yml
4747
configs:
4848
- source: loki_cfg
@@ -54,7 +54,7 @@ services:
5454
promtail:
5555
# https://github.com/grafana/loki/releases
5656
# (promtail is released in parallel with loki)
57-
image: grafana/promtail:3.1.0
57+
image: grafana/promtail:3.1.1
5858
command: -config.file=/promtail.yml
5959
configs:
6060
- source: promtail_cfg
@@ -71,7 +71,7 @@ services:
7171

7272
prometheus:
7373
# https://github.com/prometheus/prometheus/releases
74-
image: prom/prometheus:v2.53.1
74+
image: prom/prometheus:v2.53.2
7575
volumes:
7676
- prometheus_data:/prometheus
7777
command: --config.file=/prometheus.yml --storage.tsdb.retention.time=30d
@@ -110,7 +110,7 @@ services:
110110

111111
cadvisor:
112112
# https://github.com/google/cadvisor/releases
113-
image: gcr.io/cadvisor/cadvisor:v0.49.1
113+
image: gcr.io/cadvisor/cadvisor:v0.50.0
114114
networks:
115115
- app_backend
116116
volumes:

restfiles/doc-test.restfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ requests:
441441
url: ${base_url}/pointfreeco/swift-case-paths/documentation
442442
validation:
443443
status: .regex((2|3)\d\d)
444+
/pointfreeco/swift-clocks/documentation:
445+
url: ${base_url}/pointfreeco/swift-clocks/documentation
446+
validation:
447+
status: .regex((2|3)\d\d)
444448
/pointfreeco/swift-composable-architecture/documentation:
445449
url: ${base_url}/pointfreeco/swift-composable-architecture/documentation
446450
validation:
@@ -457,10 +461,18 @@ requests:
457461
url: ${base_url}/pointfreeco/swift-identified-collections/documentation
458462
validation:
459463
status: .regex((2|3)\d\d)
464+
/pointfreeco/swift-issue-reporting/documentation:
465+
url: ${base_url}/pointfreeco/swift-issue-reporting/documentation
466+
validation:
467+
status: .regex((2|3)\d\d)
460468
/pointfreeco/swift-macro-testing/documentation:
461469
url: ${base_url}/pointfreeco/swift-macro-testing/documentation
462470
validation:
463471
status: .regex((2|3)\d\d)
472+
/pointfreeco/swift-navigation/documentation:
473+
url: ${base_url}/pointfreeco/swift-navigation/documentation
474+
validation:
475+
status: .regex((2|3)\d\d)
464476
/pointfreeco/swift-perception/documentation:
465477
url: ${base_url}/pointfreeco/swift-perception/documentation
466478
validation:
@@ -473,10 +485,6 @@ requests:
473485
url: ${base_url}/pointfreeco/swift-url-routing/documentation
474486
validation:
475487
status: .regex((2|3)\d\d)
476-
/pointfreeco/swiftui-navigation/documentation:
477-
url: ${base_url}/pointfreeco/swiftui-navigation/documentation
478-
validation:
479-
status: .regex((2|3)\d\d)
480488
/richardtop/CalendarKit/documentation:
481489
url: ${base_url}/richardtop/CalendarKit/documentation
482490
validation:
@@ -586,6 +594,10 @@ requests:
586594
url: ${base_url}/swiftlang/swift-testing/documentation
587595
validation:
588596
status: .regex((2|3)\d\d)
597+
/swiftlang/swiftly/documentation:
598+
url: ${base_url}/swiftlang/swiftly/documentation
599+
validation:
600+
status: .regex((2|3)\d\d)
589601
/swiftwasm/JavaScriptKit/documentation:
590602
url: ${base_url}/swiftwasm/JavaScriptKit/documentation
591603
validation:

0 commit comments

Comments
 (0)