Skip to content

Commit 28496ed

Browse files
author
Nilanshu Sharma
committed
Disabling intergration test conditionally
Signed-off-by: Nilanshu Sharma <nilanshu_sharma@apple.com>
1 parent c69dc68 commit 28496ed

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Tests/IntegrationTests/ClientIntegrationTests.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,12 @@ struct ClientIntegratedTests {
627627
}
628628
}
629629

630-
@Test
630+
@Test(.disabled(if: clusterFirstNodeHostname == nil, "VALKEY_NODE1_HOSTNAME environment variable is not set."))
631631
@available(valkeySwift 1.0, *)
632632
func testClusterLinks() async throws {
633633
var logger = Logger(label: "Valkey")
634634
logger.logLevel = .debug
635-
try await withValkeyConnection(.hostname(valkeyHostname, port: 36001), logger: logger) { client in
635+
try await withValkeyConnection(.hostname(clusterFirstNodeHostname!, port: clusterFirstNodePort ?? 36001), logger: logger) { client in
636636
let clusterLinks = try await client.clusterLinks()
637637
#expect(!clusterLinks.isEmpty && clusterLinks.count > 0)
638638
for clusterLink in clusterLinks {
@@ -658,12 +658,13 @@ struct ClientIntegratedTests {
658658
}
659659
}
660660

661-
@Test
661+
@Test(.disabled(if: clusterFirstNodeHostname == nil, "VALKEY_NODE1_HOSTNAME environment variable is not set."))
662662
@available(valkeySwift 1.0, *)
663663
func testClusterSlotStats() async throws {
664664
var logger = Logger(label: "Valkey")
665665
logger.logLevel = .debug
666-
try await withValkeyConnection(.hostname(valkeyHostname, port: 36001), logger: logger) { client in
666+
667+
try await withValkeyConnection(.hostname(clusterFirstNodeHostname!, port: clusterFirstNodePort ?? 36001), logger: logger) { client in
667668
let slotStats = try await client.clusterSlotStats(
668669
filter: .orderby(
669670
CLUSTER.SLOTSTATS.FilterOrderby(
@@ -693,12 +694,12 @@ struct ClientIntegratedTests {
693694
}
694695
}
695696

696-
@Test
697+
@Test(.disabled(if: clusterFirstNodeHostname == nil, "VALKEY_NODE1_HOSTNAME environment variable is not set."))
697698
@available(valkeySwift 1.0, *)
698699
func testClusterSlots() async throws {
699700
var logger = Logger(label: "Valkey")
700701
logger.logLevel = .debug
701-
try await withValkeyConnection(.hostname(valkeyHostname, port: 36001), logger: logger) { client in
702+
try await withValkeyConnection(.hostname(clusterFirstNodeHostname!, port: clusterFirstNodePort ?? 36001), logger: logger) { client in
702703
let clusterSlots = try await client.clusterSlots()
703704
for clusterSlot in clusterSlots {
704705
#expect(clusterSlot.startSlot >= 0 && clusterSlot.startSlot <= 16383)
@@ -713,3 +714,6 @@ struct ClientIntegratedTests {
713714
}
714715

715716
}
717+
718+
private let clusterFirstNodeHostname: String? = ProcessInfo.processInfo.environment["VALKEY_NODE1_HOSTNAME"]
719+
private let clusterFirstNodePort: Int? = ProcessInfo.processInfo.environment["VALKEY_NODE1_PORT"].flatMap { Int($0) }

0 commit comments

Comments
 (0)