From d1b1f9326dd4fffd6a59b6580a91fe5db998c788 Mon Sep 17 00:00:00 2001 From: Nilanshu Sharma Date: Fri, 24 Oct 2025 08:57:43 -0700 Subject: [PATCH] Adding integration tests --- .../ClientIntegrationTests.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Tests/IntegrationTests/ClientIntegrationTests.swift b/Tests/IntegrationTests/ClientIntegrationTests.swift index 36791d56..5b8bd45a 100644 --- a/Tests/IntegrationTests/ClientIntegrationTests.swift +++ b/Tests/IntegrationTests/ClientIntegrationTests.swift @@ -154,6 +154,39 @@ struct ClientIntegratedTests { } } + @Test + @available(valkeySwift 1.0, *) + func testSetex() async throws { + var logger = Logger(label: "Valkey") + logger.logLevel = .debug + try await withValkeyConnection(.hostname(valkeyHostname, port: 6379), logger: logger) { connection in + try await withKey(connection: connection) { key in + try await connection.setex(key, seconds: 10, value: "Hello") + let response = try await connection.get(key).map { String(buffer: $0) } + #expect(response == "Hello") + let ttl = try await connection.ttl(key) + #expect(ttl > 0) + } + } + } + + @Test + @available(valkeySwift 1.0, *) + func testSetRange() async throws { + var logger = Logger(label: "Valkey") + logger.logLevel = .debug + try await withValkeyConnection(.hostname(valkeyHostname, port: 6379), logger: logger) { connection in + try await withKey(connection: connection) { key in + try await connection.set(key, value: "Hello World") + var response = try await connection.get(key).map { String(buffer: $0) } + #expect(response == "Hello World" ) + try await connection.setrange(key, offset: 6, value: "Valkey") + response = try await connection.get(key).map { String(buffer: $0) } + #expect(response == "Hello Valkey") + } + } + } + @Test @available(valkeySwift 1.0, *) func testSPOP() async throws {