Skip to content

Commit

Permalink
Added crossSlot test
Browse files Browse the repository at this point in the history
  • Loading branch information
GumpacG committed Jun 13, 2024
1 parent 61af157 commit e1611ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void watch() {
assertEquals(OK, clusterClient.watch(keys).get());
assertEquals(OK, clusterClient.set(key2, helloString).get());
setFoobarTransaction.set(key1, foobarString).set(key2, foobarString).set(key3, foobarString);
assertEquals(null, clusterClient.exec(setFoobarTransaction).get());
assertEquals(null, clusterClient.exec(setFoobarTransaction).get()); // Sanity check
assertEquals(null, clusterClient.get(key1).get());
assertEquals(helloString, clusterClient.get(key2).get());
assertEquals(null, clusterClient.get(key3).get());
Expand All @@ -199,14 +199,14 @@ public void watch() {
assertEquals(OK, clusterClient.watch(keys).get());
assertEquals(helloString, clusterClient.get(key2).get());
assertArrayEquals(expectedExecResponse, clusterClient.exec(setFoobarTransaction).get());
assertEquals(foobarString, clusterClient.get(key1).get());
assertEquals(foobarString, clusterClient.get(key1).get()); // Sanity check
assertEquals(foobarString, clusterClient.get(key2).get());
assertEquals(foobarString, clusterClient.get(key3).get());

// Transaction executes command successfully with unmodified watched keys
assertEquals(OK, clusterClient.watch(keys).get());
assertArrayEquals(expectedExecResponse, clusterClient.exec(setFoobarTransaction).get());
assertEquals(foobarString, clusterClient.get(key1).get());
assertEquals(foobarString, clusterClient.get(key1).get()); // Sanity check
assertEquals(foobarString, clusterClient.get(key2).get());
assertEquals(foobarString, clusterClient.get(key3).get());

Expand All @@ -215,7 +215,7 @@ public void watch() {
assertEquals(OK, clusterClient.watch(new String[] {key4}).get());
setHelloTransaction.set(key1, helloString).set(key2, helloString).set(key3, helloString);
assertArrayEquals(expectedExecResponse, clusterClient.exec(setHelloTransaction).get());
assertEquals(helloString, clusterClient.get(key1).get());
assertEquals(helloString, clusterClient.get(key1).get()); // Sanity check
assertEquals(helloString, clusterClient.get(key2).get());
assertEquals(helloString, clusterClient.get(key3).get());

Expand Down
3 changes: 2 additions & 1 deletion java/integTest/src/test/java/glide/cluster/CommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,8 @@ public static Stream<Arguments> callCrossSlotCommandsWhichShouldPass() {
Arguments.of("del", clusterClient.del(new String[] {"abc", "zxy", "lkn"})),
Arguments.of("mget", clusterClient.mget(new String[] {"abc", "zxy", "lkn"})),
Arguments.of("mset", clusterClient.mset(Map.of("abc", "1", "zxy", "2", "lkn", "3"))),
Arguments.of("touch", clusterClient.touch(new String[] {"abc", "zxy", "lkn"})));
Arguments.of("touch", clusterClient.touch(new String[] {"abc", "zxy", "lkn"})),
Arguments.of("watch", clusterClient.watch(new String[] {"ghi", "zxy", "lkn"})));
}

@SneakyThrows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public void watch() {
assertEquals(OK, client.set(key2, helloString).get());
setFoobarTransaction.set(key1, foobarString).set(key2, foobarString).set(key3, foobarString);
assertEquals(null, client.exec(setFoobarTransaction).get());
assertEquals(null, client.get(key1).get());
assertEquals(null, client.get(key1).get()); // Sanity check
assertEquals(helloString, client.get(key2).get());
assertEquals(null, client.get(key3).get());

Expand All @@ -287,14 +287,14 @@ public void watch() {
assertEquals(OK, client.watch(keys).get());
assertEquals(helloString, client.get(key2).get());
assertArrayEquals(expectedExecResponse, client.exec(setFoobarTransaction).get());
assertEquals(foobarString, client.get(key1).get());
assertEquals(foobarString, client.get(key1).get()); // Sanity check
assertEquals(foobarString, client.get(key2).get());
assertEquals(foobarString, client.get(key3).get());

// Transaction executes command successfully with unmodified watched keys
assertEquals(OK, client.watch(keys).get());
assertArrayEquals(expectedExecResponse, client.exec(setFoobarTransaction).get());
assertEquals(foobarString, client.get(key1).get());
assertEquals(foobarString, client.get(key1).get()); // Sanity check
assertEquals(foobarString, client.get(key2).get());
assertEquals(foobarString, client.get(key3).get());

Expand All @@ -303,7 +303,7 @@ public void watch() {
assertEquals(OK, client.watch(new String[] {key4}).get());
setHelloTransaction.set(key1, helloString).set(key2, helloString).set(key3, helloString);
assertArrayEquals(expectedExecResponse, client.exec(setHelloTransaction).get());
assertEquals(helloString, client.get(key1).get());
assertEquals(helloString, client.get(key1).get()); // Sanity check
assertEquals(helloString, client.get(key2).get());
assertEquals(helloString, client.get(key3).get());

Expand Down

0 comments on commit e1611ae

Please sign in to comment.