Skip to content

Commit

Permalink
Update Valkey version to 8.0.0 in test matrix and version checks (val…
Browse files Browse the repository at this point in the history
…key-io#2296)

Signed-off-by: Shoham Elias <shohame@amazon.com>
  • Loading branch information
shohamazon committed Sep 23, 2024
1 parent 4e0b4aa commit 36649ab
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .github/json_matrices/engine-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
},
{
"type": "valkey",
"version": "8.0.0-rc1"
"version": "8.0.0"
}
]
44 changes: 18 additions & 26 deletions java/integTest/src/test/java/glide/SharedCommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -918,14 +918,10 @@ public void getrange(BaseClient client) {
assertEquals("", client.getrange(stringKey, -1, -3).get());

// a redis bug, fixed in version 8: https://github.com/redis/redis/issues/13207
assertEquals(
SERVER_VERSION.isLowerThan("8.0.0") ? "T" : "",
client.getrange(stringKey, -200, -100).get());
assertEquals("T", client.getrange(stringKey, -200, -100).get());

// empty key (returning null isn't implemented)
assertEquals(
SERVER_VERSION.isLowerThan("8.0.0") ? "" : null,
client.getrange(nonStringKey, 0, -1).get());
assertEquals("", client.getrange(nonStringKey, 0, -1).get());

// non-string key
assertEquals(1, client.lpush(nonStringKey, new String[] {"_"}).get());
Expand Down Expand Up @@ -955,14 +951,10 @@ public void getrange_binary(BaseClient client) {
assertEquals(gs(""), client.getrange(stringKey, -1, -3).get());

// a redis bug, fixed in version 8: https://github.com/redis/redis/issues/13207
assertEquals(
gs(SERVER_VERSION.isLowerThan("8.0.0") ? "T" : ""),
client.getrange(stringKey, -200, -100).get());
assertEquals(gs("T"), client.getrange(stringKey, -200, -100).get());

// empty key (returning null isn't implemented)
assertEquals(
gs(SERVER_VERSION.isLowerThan("8.0.0") ? "" : null),
client.getrange(nonStringKey, 0, -1).get());
assertEquals(gs(""), client.getrange(nonStringKey, 0, -1).get());

// non-string key
assertEquals(1, client.lpush(nonStringKey, new GlideString[] {gs("_")}).get());
Expand Down Expand Up @@ -3279,7 +3271,7 @@ public void persist_on_existing_and_non_existing_key(BaseClient client) {
@ParameterizedTest(autoCloseArguments = false)
@MethodSource("getClients")
public void scriptShow_test(BaseClient client) {
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0"));
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0"));

String code = "return '" + UUID.randomUUID().toString().substring(0, 5) + "'";
Script script = new Script(code, false);
Expand Down Expand Up @@ -10423,7 +10415,7 @@ public void bitcount(BaseClient client) {
() -> client.bitcount(key1, 5, 30, BitmapIndexType.BIT).get());
assertTrue(executionException.getCause() instanceof RequestException);
}
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
assertEquals(26L, client.bitcount(key1, 0).get());
assertEquals(4L, client.bitcount(key1, 5).get());
assertEquals(0L, client.bitcount(key1, 80).get());
Expand Down Expand Up @@ -12557,7 +12549,7 @@ public void sort_binary(BaseClient client) {
@MethodSource("getClients")
public void sort_with_pattern(BaseClient client) {
if (client instanceof GlideClusterClient) {
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0"), "This feature added in version 8");
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0"), "This feature added in version 8");
}
String setKey1 = "{setKey}1";
String setKey2 = "{setKey}2";
Expand Down Expand Up @@ -12739,7 +12731,7 @@ public void sort_with_pattern(BaseClient client) {
@MethodSource("getClients")
public void sort_with_pattern_binary(BaseClient client) {
if (client instanceof GlideClusterClient) {
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0"), "This feature added in version 8");
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0"), "This feature added in version 8");
}

GlideString setKey1 = gs("{setKeyGs}1");
Expand Down Expand Up @@ -14291,7 +14283,7 @@ public void sscan(BaseClient client) {
assertDeepEquals(new String[] {}, result[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> client.sscan(key1, "-1").get());
} else {
Expand Down Expand Up @@ -14432,7 +14424,7 @@ public void sscan_binary(BaseClient client) {
assertDeepEquals(new GlideString[] {}, result[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> client.sscan(key1, gs("-1")).get());
} else {
Expand Down Expand Up @@ -14586,7 +14578,7 @@ public void zscan(BaseClient client) {
assertDeepEquals(new String[] {}, result[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> client.zscan(key1, "-1").get());
} else {
Expand Down Expand Up @@ -14710,7 +14702,7 @@ public void zscan(BaseClient client) {
assertTrue(Long.parseLong(result[resultCursorIndex].toString()) >= 0);
assertTrue(ArrayUtils.getLength(result[resultCollectionIndex]) >= 0);

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
result =
client.zscan(key1, initialCursor, ZScanOptions.builder().noScores(true).build()).get();
assertTrue(Long.parseLong(result[resultCursorIndex].toString()) >= 0);
Expand Down Expand Up @@ -14788,7 +14780,7 @@ public void zscan_binary(BaseClient client) {
assertDeepEquals(new GlideString[] {}, result[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> client.zscan(key1, gs("-1")).get());
} else {
Expand Down Expand Up @@ -14917,7 +14909,7 @@ public void zscan_binary(BaseClient client) {
assertTrue(Long.parseLong(result[resultCursorIndex].toString()) >= 0);
assertTrue(ArrayUtils.getLength(result[resultCollectionIndex]) >= 0);

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
result =
client
.zscan(key1, initialCursor, ZScanOptionsBinary.builder().noScores(true).build())
Expand Down Expand Up @@ -14993,7 +14985,7 @@ public void hscan(BaseClient client) {
assertDeepEquals(new String[] {}, result[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> client.hscan(key1, "-1").get());
} else {
Expand Down Expand Up @@ -15104,7 +15096,7 @@ public void hscan(BaseClient client) {
assertTrue(Long.parseLong(result[resultCursorIndex].toString()) >= 0);
assertTrue(ArrayUtils.getLength(result[resultCollectionIndex]) >= 0);

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
result =
client.hscan(key1, initialCursor, HScanOptions.builder().noValues(true).build()).get();
assertTrue(Long.parseLong(result[resultCursorIndex].toString()) >= 0);
Expand Down Expand Up @@ -15175,7 +15167,7 @@ public void hscan_binary(BaseClient client) {
assertDeepEquals(new GlideString[] {}, result[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> client.hscan(key1, gs("-1")).get());
} else {
Expand Down Expand Up @@ -15293,7 +15285,7 @@ public void hscan_binary(BaseClient client) {
assertTrue(Long.parseLong(result[resultCursorIndex].toString()) >= 0);
assertTrue(ArrayUtils.getLength(result[resultCollectionIndex]) >= 0);

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
result =
client
.hscan(key1, initialCursor, HScanOptionsBinary.builder().noValues(true).build())
Expand Down
12 changes: 6 additions & 6 deletions java/integTest/src/test/java/glide/TransactionTestUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private static Object[] hashCommands(BaseTransaction<?> transaction) {
.hscan(hashKey2, "0")
.hscan(hashKey2, "0", HScanOptions.builder().count(20L).build());

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
transaction
.hscan(hashKey2, "0", HScanOptions.builder().count(20L).noValues(false).build())
.hscan(hashKey2, "0", HScanOptions.builder().count(20L).noValues(true).build());
Expand Down Expand Up @@ -417,7 +417,7 @@ private static Object[] hashCommands(BaseTransaction<?> transaction) {
}, // hscan(hashKey2, "0", HScanOptions.builder().count(20L).build());
};

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
result =
concatenateArrays(
result,
Expand Down Expand Up @@ -670,7 +670,7 @@ private static Object[] sortedSetCommands(BaseTransaction<?> transaction) {
.zrandmemberWithCountWithScores(zSetKey2, 1)
.zscan(zSetKey2, "0")
.zscan(zSetKey2, "0", ZScanOptions.builder().count(20L).build());
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
transaction
.zscan(zSetKey2, 0, ZScanOptions.builder().count(20L).noScores(false).build())
.zscan(zSetKey2, 0, ZScanOptions.builder().count(20L).noScores(true).build());
Expand Down Expand Up @@ -741,7 +741,7 @@ private static Object[] sortedSetCommands(BaseTransaction<?> transaction) {
}, // zscan(zSetKey2, 0, ZScanOptions.builder().count(20L).build())
};

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
expectedResults =
concatenateArrays(
expectedResults,
Expand Down Expand Up @@ -1288,7 +1288,7 @@ private static Object[] bitmapCommands(BaseTransaction<?> transaction) {
.bitpos(key3, 1, 44, 50, BitmapIndexType.BIT);
}

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
transaction.set(key4, "foobar").bitcount(key4, 0);
}

Expand Down Expand Up @@ -1321,7 +1321,7 @@ private static Object[] bitmapCommands(BaseTransaction<?> transaction) {
});
}

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
expectedResults =
concatenateArrays(
expectedResults,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public void sort() {
transaction.sortReadOnly(key1, SortOptions.builder().orderBy(DESC).build());
}

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
transaction
.hset(key3, Map.of("name", "Alice", "age", "30"))
.hset(key4, Map.of("name", "Bob", "age", "25"))
Expand Down Expand Up @@ -358,7 +358,7 @@ public void sort() {
);
}

if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
expectedResult =
concatenateArrays(
expectedResult,
Expand Down
6 changes: 3 additions & 3 deletions java/integTest/src/test/java/glide/cluster/CommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ public void flushall() {
assertEquals(OK, clusterClient.flushall(ASYNC, route).get());

var replicaRoute = new SlotKeyRoute("key", REPLICA);
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
// Since Valkey 8.0.0 flushall can run on replicas
assertEquals(OK, clusterClient.flushall(route).get());
} else {
Expand Down Expand Up @@ -1650,7 +1650,7 @@ public void fcall_binary_with_keys(String prefix) {
public void fcall_readonly_function() {
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("7.0.0"), "This feature added in version 7");
assumeTrue(
!SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0"),
!SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0"),
"Temporary disabeling this test on valkey 8");

String libName = "fcall_readonly_function";
Expand Down Expand Up @@ -1708,7 +1708,7 @@ public void fcall_readonly_function() {
public void fcall_readonly_binary_function() {
assumeTrue(SERVER_VERSION.isGreaterThanOrEqualTo("7.0.0"), "This feature added in version 7");
assumeTrue(
!SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0"),
!SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0"),
"Temporary disabeling this test on valkey 8");

String libName = "fcall_readonly_function";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ public void scan() {
assertDeepEquals(new String[] {}, emptyResult[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> regularClient.scan("-1").get());
} else {
Expand Down Expand Up @@ -1235,7 +1235,7 @@ public void scan_binary() {
assertDeepEquals(new String[] {}, emptyResult[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
ExecutionException executionException =
assertThrows(ExecutionException.class, () -> regularClient.scan(gs("-1")).get());
} else {
Expand Down Expand Up @@ -1303,7 +1303,7 @@ public void scan_with_options() {
assertDeepEquals(new String[] {}, emptyResult[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
final ScanOptions finalOptions = options;
ExecutionException executionException =
assertThrows(
Expand Down Expand Up @@ -1392,7 +1392,7 @@ public void scan_binary_with_options() {
assertDeepEquals(new String[] {}, emptyResult[resultCollectionIndex]);

// Negative cursor
if (SERVER_VERSION.isGreaterThanOrEqualTo("7.9.0")) {
if (SERVER_VERSION.isGreaterThanOrEqualTo("8.0.0")) {
final ScanOptions finalOptions = options;
ExecutionException executionException =
assertThrows(
Expand Down
25 changes: 10 additions & 15 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ export function runBaseTests(config: {
it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
`getrange test_%p`,
async (protocol) => {
await runTest(async (client: BaseClient, cluster) => {
await runTest(async (client: BaseClient) => {
const key = uuidv4();
const nonStringKey = uuidv4();
const valueEncoded = Buffer.from("This is a string");
Expand Down Expand Up @@ -1337,15 +1337,10 @@ export function runBaseTests(config: {
// incorrect range
expect(await client.getrange(key, -1, -3)).toEqual("");

// a bug fixed in version 8: https://github.com/redis/redis/issues/13207
expect(await client.getrange(key, -200, -100)).toEqual(
cluster.checkIfServerVersionLessThan("8.0.0") ? "T" : "",
);
expect(await client.getrange(key, -200, -100)).toEqual("T");

// empty key (returning null isn't implemented)
expect(await client.getrange(nonStringKey, 0, -1)).toEqual(
cluster.checkIfServerVersionLessThan("8.0.0") ? "" : null,
);
expect(await client.getrange(nonStringKey, 0, -1)).toEqual("");

// non-string key
expect(await client.lpush(nonStringKey, ["_"])).toEqual(1);
Expand Down Expand Up @@ -1604,7 +1599,7 @@ export function runBaseTests(config: {
expect(result[resultCursorIndex]).not.toEqual(initialCursor);
expect(result[resultCollectionIndex].length).toBeGreaterThan(0);

if (!cluster.checkIfServerVersionLessThan("7.9.0")) {
if (!cluster.checkIfServerVersionLessThan("8.0.0")) {
const result = await client.hscan(key1, initialCursor, {
noValues: true,
});
Expand Down Expand Up @@ -1645,7 +1640,7 @@ export function runBaseTests(config: {
expect(result2[resultCollectionIndex]).toEqual([]);

// Negative cursor
if (cluster.checkIfServerVersionLessThan("7.9.0")) {
if (cluster.checkIfServerVersionLessThan("8.0.0")) {
result = await client.hscan(key1, "-1");
expect(result[resultCursorIndex]).toEqual(
initialCursor,
Expand Down Expand Up @@ -4194,7 +4189,7 @@ export function runBaseTests(config: {
`script show test_%p`,
async (protocol) => {
await runTest(async (client: BaseClient, cluster) => {
if (cluster.checkIfServerVersionLessThan("7.9.0")) {
if (cluster.checkIfServerVersionLessThan("8.0.0")) {
return;
}

Expand Down Expand Up @@ -8921,7 +8916,7 @@ export function runBaseTests(config: {
).rejects.toThrow(RequestError);
}

if (cluster.checkIfServerVersionLessThan("7.9.0")) {
if (cluster.checkIfServerVersionLessThan("8.0.0")) {
await expect(
client.bitcount(key1, {
start: 2,
Expand Down Expand Up @@ -9755,7 +9750,7 @@ export function runBaseTests(config: {
expect(result[resultCollectionIndex]).toEqual([]);

// Negative cursor
if (cluster.checkIfServerVersionLessThan("7.9.0")) {
if (cluster.checkIfServerVersionLessThan("8.0.0")) {
result = await client.zscan(key1, "-1");
expect(result[resultCursorIndex]).toEqual(
initialCursor,
Expand Down Expand Up @@ -9869,7 +9864,7 @@ export function runBaseTests(config: {
result[resultCollectionIndex].length,
).toBeGreaterThan(0);

if (!cluster.checkIfServerVersionLessThan("7.9.0")) {
if (!cluster.checkIfServerVersionLessThan("8.0.0")) {
const result = await client.zscan(key1, initialCursor, {
noScores: true,
});
Expand Down Expand Up @@ -12079,7 +12074,7 @@ export function runBaseTests(config: {
await runTest(
async (client: BaseClient, cluster: ValkeyCluster) => {
if (
cluster.checkIfServerVersionLessThan("7.9.0") &&
cluster.checkIfServerVersionLessThan("8.0.0") &&
client instanceof GlideClusterClient
) {
return;
Expand Down
Loading

0 comments on commit 36649ab

Please sign in to comment.