Skip to content

Commit c13cfa6

Browse files
committed
Add retries to HTTPClientTests to work around CI issues
1 parent ff4a707 commit c13cfa6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Tests/SwiftlyTests/HTTPClientTests.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ import Testing
1616

1717
let gpgKeysUrl = URL(string: "https://www.swift.org/keys/all-keys.asc")!
1818

19-
try await httpClient.downloadFile(url: gpgKeysUrl, to: tmpFile)
19+
do {
20+
try await httpClient.downloadFile(url: gpgKeysUrl, to: tmpFile)
21+
} catch {
22+
// Retry once to improve CI resiliency
23+
try await httpClient.downloadFile(url: gpgKeysUrl, to: tmpFile)
24+
}
2025

2126
#if os(Linux)
2227
// With linux, we can ask gpg to try an import to see if the file is valid
@@ -33,8 +38,13 @@ import Testing
3338

3439
@Test func getSwiftlyReleaseMetadataFromSwiftOrg() async throws {
3540
let httpClient = SwiftlyHTTPClient(httpRequestExecutor: HTTPRequestExecutorImpl())
36-
let currentRelease = try await httpClient.getCurrentSwiftlyRelease()
37-
#expect(throws: Never.self) { try currentRelease.swiftlyVersion }
41+
do {
42+
let currentRelease = try await httpClient.getCurrentSwiftlyRelease()
43+
#expect(throws: Never.self) { try currentRelease.swiftlyVersion }
44+
} catch {
45+
let currentRelease = try await httpClient.getCurrentSwiftlyRelease()
46+
#expect(throws: Never.self) { try currentRelease.swiftlyVersion }
47+
}
3848
}
3949

4050
@Test(

0 commit comments

Comments
 (0)