Skip to content

Commit 04064f6

Browse files
authored
Wrong platform requirement for Benchmarks (#202)
* Benchmark requirements macOS 13 Signed-off-by: Adam Fowler <[email protected]> * Missed available attributes Signed-off-by: Adam Fowler <[email protected]> --------- Signed-off-by: Adam Fowler <[email protected]>
1 parent 7fa90d1 commit 04064f6

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ let package = Package(
9797
)
9898

9999
if Context.environment["ENABLE_VALKEY_BENCHMARKS"] != nil {
100-
package.platforms = [.macOS(.v10_15)]
100+
package.platforms = [.macOS(.v13)]
101101
package.dependencies.append(
102102
.package(url: "https://github.com/ordo-one/package-benchmark", from: "1.0.0")
103103
)

Tests/IntegrationTests/ValkeyTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import Valkey
2222

2323
struct GeneratedCommands {
2424
let valkeyHostname = ProcessInfo.processInfo.environment["VALKEY_HOSTNAME"] ?? "localhost"
25+
26+
@available(valkeySwift 1.0, *)
2527
func withKey<Value>(connection: some ValkeyClientProtocol, _ operation: (ValkeyKey) async throws -> Value) async throws -> Value {
2628
let key = ValkeyKey(UUID().uuidString)
2729
let value: Value

Tests/ValkeyTests/Cluster/ValkeyClusterClientStateMachineTests.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ struct ValkeyClusterClientStateMachineTests {
3030
TimerCancellationToken
3131
>
3232

33-
let testConfiguration = ValkeyClusterClientStateMachineConfiguration(
34-
circuitBreakerDuration: .seconds(30),
35-
defaultClusterRefreshInterval: .seconds(60)
36-
)
33+
@available(valkeySwift 1.0, *)
34+
var testConfiguration: ValkeyClusterClientStateMachineConfiguration {
35+
.init(
36+
circuitBreakerDuration: .seconds(30),
37+
defaultClusterRefreshInterval: .seconds(60)
38+
)
39+
}
3740

3841
@Test
3942
@available(valkeySwift 1.0, *)
@@ -119,6 +122,7 @@ struct ValkeyClusterClientStateMachineTests {
119122

120123
}
121124

125+
@available(valkeySwift 1.0, *)
122126
extension ValkeyClusterClientStateMachine.WaitForHealthyAction {
123127
var isNone: Bool {
124128
switch self {

Tests/ValkeyTests/Cluster/ValkeyTopologyCandidateTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Valkey
1919
struct ValkeyTopologyCandidateTests {
2020

2121
@Test("Ensure the same description in different order is considered equal")
22+
@available(valkeySwift 1.0, *)
2223
func ensureOrderDoesntMatter() throws {
2324
let description = ValkeyClusterDescription([
2425
.init(
@@ -113,6 +114,7 @@ struct ValkeyTopologyCandidateTests {
113114
}
114115

115116
@Test("Two primary nodes for the same shard throws")
117+
@available(valkeySwift 1.0, *)
116118
func twoPrimaryNodesForTheSameShardThrows() {
117119
let description = ValkeyClusterDescription([
118120
.init(
@@ -159,6 +161,7 @@ struct ValkeyTopologyCandidateTests {
159161
}
160162

161163
@Test("No primary node for a shard throws")
164+
@available(valkeySwift 1.0, *)
162165
func noPrimaryNodeForAShardThrows() {
163166
let description = ValkeyClusterDescription([
164167
.init(

Tests/ValkeyTests/Cluster/ValkeyTopologyElectionTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,14 @@ struct ValkeyTopologyElectionTests {
116116
}
117117

118118
@Test("Initial state has no winner")
119+
@available(valkeySwift 1.0, *)
119120
func initialState() {
120121
let election = ValkeyTopologyElection()
121122
#expect(election.winner == nil)
122123
}
123124

124125
@Test("Single vote does not establish a winner in multi node scenario")
126+
@available(valkeySwift 1.0, *)
125127
func singleVoteBelowThreshold() throws {
126128
var election = ValkeyTopologyElection()
127129

@@ -139,6 +141,7 @@ struct ValkeyTopologyElectionTests {
139141
}
140142

141143
@Test("Sufficient votes establish a winner")
144+
@available(valkeySwift 1.0, *)
142145
func sufficientVotesToWin() throws {
143146
var election = ValkeyTopologyElection()
144147
let description = createSingleShardCluster()
@@ -154,6 +157,7 @@ struct ValkeyTopologyElectionTests {
154157
}
155158

156159
@Test("First candidate to reach threshold becomes winner")
160+
@available(valkeySwift 1.0, *)
157161
func firstCandidateWins() throws {
158162
var election = ValkeyTopologyElection()
159163

@@ -185,6 +189,7 @@ struct ValkeyTopologyElectionTests {
185189
}
186190

187191
@Test("The same instance voting twice for the same candidate doesn't count twice")
192+
@available(valkeySwift 1.0, *)
188193
func sameInstanceVotingTwiceDoesntCountTwice() throws {
189194
var election = ValkeyTopologyElection()
190195

@@ -215,6 +220,7 @@ struct ValkeyTopologyElectionTests {
215220
}
216221

217222
@Test("The same instance can move its vote to another candidate")
223+
@available(valkeySwift 1.0, *)
218224
func sameInstanceVotingTwiceRemovesCountForInitialVote() throws {
219225
var election = ValkeyTopologyElection()
220226

@@ -249,6 +255,7 @@ struct ValkeyTopologyElectionTests {
249255
}
250256

251257
@Test("Topology candidates with same structure are equal")
258+
@available(valkeySwift 1.0, *)
252259
func topologyCandidateEquality() throws {
253260
// Create two descriptions with the same structure but different node IDs
254261
let description1 = createSingleShardCluster(id: "node1")
@@ -266,6 +273,7 @@ struct ValkeyTopologyElectionTests {
266273
}
267274

268275
@Test("Different topology structures produce different candidates")
276+
@available(valkeySwift 1.0, *)
269277
func differentTopologyStructures() throws {
270278
let description1 = createSingleShardCluster(slots: [0...5000])
271279
let description2 = createSingleShardCluster(slots: [0...8000])

0 commit comments

Comments
 (0)