Skip to content

Commit 354321d

Browse files
committed
Fix HTTPClientTests failures
1 parent ab87ffd commit 354321d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Sources/SwiftlyCore/HTTPClient.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ extension Components.Schemas.Release {
208208
}
209209
}
210210

211+
extension Components.Schemas.Architecture {
212+
static var x8664: Components.Schemas.Architecture = .init(value1: Components.Schemas.KnownArchitecture.x8664, value2: "x86_64")
213+
static var aarch64: Components.Schemas.Architecture = .init(value1: Components.Schemas.KnownArchitecture.aarch64, value2: "aarch64")
214+
}
215+
211216
extension Components.Schemas.Platform {
212217
/// platformDef is a mapping from the 'name' field of the swift.org platform object
213218
/// to swiftly's PlatformDefinition, if possible.

Sources/SwiftlyCore/SwiftlyCore.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public func readLine(prompt: String) -> String? {
5353
}
5454

5555
#if arch(x86_64)
56-
public let cpuArch = Components.Schemas.Architecture(value1: Components.Schemas.KnownArchitecture.x8664)
56+
public let cpuArch = Components.Schemas.Architecture.x8664
5757
#elseif arch(arm64)
58-
public let cpuArch = Components.Schemas.Architecture(value1: Components.Schemas.KnownArchitecture.aarch64)
58+
public let cpuArch = Components.Schemas.Architecture.aarch64
5959
#else
6060
#error("Unsupported processor architecture")
6161
#endif

Tests/SwiftlyTests/HTTPClientTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ final class HTTPClientTests: SwiftlyTests {
7474
.release(major: 6, minor: 0), // This is available in swift.org API
7575
]
7676

77-
for arch in [Components.Schemas.Architecture(value1: Components.Schemas.KnownArchitecture.x8664), Components.Schemas.Architecture(value1: Components.Schemas.KnownArchitecture.aarch64)] {
77+
for arch in [Components.Schemas.Architecture.x8664, Components.Schemas.Architecture.aarch64] {
7878
for platform in supportedPlatforms {
7979
// GIVEN: we have a swiftly http client with swift.org metadata capability
8080
// WHEN: we ask for the first five releases of a supported platform in a supported arch
@@ -87,7 +87,7 @@ final class HTTPClientTests: SwiftlyTests {
8787
for branch in branches {
8888
// GIVEN: we have a swiftly http client with swift.org metadata capability
8989
// WHEN: we ask for the first five snapshots on a branch for a supported platform and arch
90-
let snapshots = try await SwiftlyCore.httpClient.getSnapshotToolchains(platform: platform, arch: String(describing: arch), branch: branch, limit: 5)
90+
let snapshots = try await SwiftlyCore.httpClient.getSnapshotToolchains(platform: platform, arch: arch.value2!, branch: branch, limit: 5)
9191
// THEN: we get at least 3 releases
9292
XCTAssertTrue(3 <= snapshots.count)
9393
}

0 commit comments

Comments
 (0)