You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/05/06 20:03:49 UTC
[GitHub] [geode] jdeppe-pivotal opened a new pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
jdeppe-pivotal opened a new pull request #6447:
URL: https://github.com/apache/geode/pull/6447
Thank you for submitting a contribution to Apache Geode.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
- [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
- [ ] Is your initial contribution a single, squashed commit?
- [ ] Does `gradlew build` run cleanly?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
### Note:
Please ensure that once the PR is submitted, check Concourse for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629433722
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
##########
@@ -54,68 +55,71 @@ public void errors_givenWrongNumberOfArguments() {
@Test
public void givenSplat_withASCIIdata_returnsExpectedMatches() {
- jedis.set("string1", "v1");
- jedis.sadd("set1", "member1");
- jedis.hset("hash1", "key1", "field1");
- assertThat(jedis.keys("*")).containsExactlyInAnyOrder("string1", "set1", "hash1");
- assertThat(jedis.keys("s*")).containsExactlyInAnyOrder("string1", "set1");
- assertThat(jedis.keys("h*")).containsExactlyInAnyOrder("hash1");
- assertThat(jedis.keys("foo*")).isEmpty();
+ jedis.set("{K}string1", "v1");
+ jedis.sadd("{K}set1", "member1");
+ jedis.hset("{K}hash1", "key1", "field1");
+ assertThat(jedis.keys("{K}*")).containsExactlyInAnyOrder("{K}string1", "{K}set1", "{K}hash1");
+ assertThat(jedis.keys("{K}s*")).containsExactlyInAnyOrder("{K}string1", "{K}set1");
+ assertThat(jedis.keys("{K}h*")).containsExactlyInAnyOrder("{K}hash1");
+ assertThat(jedis.keys("{K}foo*")).isEmpty();
}
@Test
public void givenSplat_withBinaryData_returnsExpectedMatches() {
byte[] stringKey =
- new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g', '1'};
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g',
+ '1'};
byte[] value = new byte[] {'v', '1'};
jedis.set(stringKey, value);
- byte[] setKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
+ byte[] setKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
byte[] member = new byte[] {'m', '1'};
jedis.sadd(setKey, member);
- byte[] hashKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
- byte[] key = new byte[] {'k', 'e', 'y', '1'};
+ byte[] hashKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
+ byte[] key = new byte[] {'{', 1, '}', 'k', 'e', 'y', '1'};
jedis.hset(hashKey, key, value);
assertThat(jedis.exists(stringKey));
assertThat(jedis.exists(setKey));
assertThat(jedis.exists(hashKey));
Review comment:
Fixed. Well spotted!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal merged pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal merged pull request #6447:
URL: https://github.com/apache/geode/pull/6447
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] sabbey37 commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r628246428
##########
File path: geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/key/DelNativeRedisAcceptanceTest.java
##########
@@ -16,17 +16,27 @@
package org.apache.geode.redis.internal.executor.key;
import org.junit.ClassRule;
+import org.junit.Test;
-import org.apache.geode.NativeRedisTestRule;
+import org.apache.geode.redis.NativeRedisClusterTestRule;
public class DelNativeRedisAcceptanceTest extends AbstractDelIntegrationTest {
@ClassRule
- public static NativeRedisTestRule redis = new NativeRedisTestRule();
+ public static NativeRedisClusterTestRule redis = new NativeRedisClusterTestRule();
@Override
public int getPort() {
- return redis.getPort();
+ return redis.getExposedPorts().get(0);
}
+ @Override
+ public void flushAll() {
+ redis.flushAll();
+ }
+
+ @Test
+ public void doNothing() {
+ // nothing done
+ }
Review comment:
What's this test for?
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractScanIntegrationTest.java
##########
@@ -49,7 +49,7 @@ public void setUp() {
@After
public void tearDown() {
- jedis.flushAll();
+ flushAll();
jedis.close();
}
Review comment:
Did we decide not to switch this test to use a Jedis Cluster?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] sabbey37 commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629417419
##########
File path: geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/key/DelNativeRedisAcceptanceTest.java
##########
@@ -16,17 +16,27 @@
package org.apache.geode.redis.internal.executor.key;
import org.junit.ClassRule;
+import org.junit.Test;
-import org.apache.geode.NativeRedisTestRule;
+import org.apache.geode.redis.NativeRedisClusterTestRule;
public class DelNativeRedisAcceptanceTest extends AbstractDelIntegrationTest {
@ClassRule
- public static NativeRedisTestRule redis = new NativeRedisTestRule();
+ public static NativeRedisClusterTestRule redis = new NativeRedisClusterTestRule();
@Override
public int getPort() {
- return redis.getPort();
+ return redis.getExposedPorts().get(0);
}
+ @Override
+ public void flushAll() {
+ redis.flushAll();
+ }
+
+ @Test
+ public void doNothing() {
+ // nothing done
+ }
Review comment:
Somehow this wasn't removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] sabbey37 commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629417419
##########
File path: geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/key/DelNativeRedisAcceptanceTest.java
##########
@@ -16,17 +16,27 @@
package org.apache.geode.redis.internal.executor.key;
import org.junit.ClassRule;
+import org.junit.Test;
-import org.apache.geode.NativeRedisTestRule;
+import org.apache.geode.redis.NativeRedisClusterTestRule;
public class DelNativeRedisAcceptanceTest extends AbstractDelIntegrationTest {
@ClassRule
- public static NativeRedisTestRule redis = new NativeRedisTestRule();
+ public static NativeRedisClusterTestRule redis = new NativeRedisClusterTestRule();
@Override
public int getPort() {
- return redis.getPort();
+ return redis.getExposedPorts().get(0);
}
+ @Override
+ public void flushAll() {
+ redis.flushAll();
+ }
+
+ @Test
+ public void doNothing() {
+ // nothing done
+ }
Review comment:
Somehow I think this still wasn't removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on pull request #6447:
URL: https://github.com/apache/geode/pull/6447#issuecomment-834735135
> It doesn't look like `KeysNativeRedisAcceptanceTest` or `ScanNativeRedisAcceptanceTest` got switched over to use the `NativeRedisClusterTestRule`. We also didn't edit `AbstractKeysIntegrationTest` to use a `JedisCluster` in addition to `AbstractScanIntegrationTest`. Did we not switch the `AbstractKeysIntegrationTest` and `KeysNativeRedisAcceptanceTest` to use a cluster due to the slots issue?
I had previously thought that `scan` and `keys` didn't apply to clusters, but I was wrong, so those are added now. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629354992
##########
File path: geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/key/DelNativeRedisAcceptanceTest.java
##########
@@ -16,17 +16,27 @@
package org.apache.geode.redis.internal.executor.key;
import org.junit.ClassRule;
+import org.junit.Test;
-import org.apache.geode.NativeRedisTestRule;
+import org.apache.geode.redis.NativeRedisClusterTestRule;
public class DelNativeRedisAcceptanceTest extends AbstractDelIntegrationTest {
@ClassRule
- public static NativeRedisTestRule redis = new NativeRedisTestRule();
+ public static NativeRedisClusterTestRule redis = new NativeRedisClusterTestRule();
@Override
public int getPort() {
- return redis.getPort();
+ return redis.getExposedPorts().get(0);
}
+ @Override
+ public void flushAll() {
+ redis.flushAll();
+ }
+
+ @Test
+ public void doNothing() {
+ // nothing done
+ }
Review comment:
Leftover from some debugging - now gone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629355316
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractScanIntegrationTest.java
##########
@@ -49,7 +49,7 @@ public void setUp() {
@After
public void tearDown() {
- jedis.flushAll();
+ flushAll();
jedis.close();
}
Review comment:
It is switched now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629355784
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractDelIntegrationTest.java
##########
@@ -97,10 +95,9 @@ public void testConcurrentDel_differentClients() {
AtomicLong deletedCount = new AtomicLong();
new ConcurrentLoopingThreads(ITERATION_COUNT,
(i) -> deletedCount.addAndGet(jedis.del(keyBaseName + i)),
- (i) -> deletedCount.addAndGet(jedis2.del(keyBaseName + i)))
+ (i) -> deletedCount.addAndGet(jedis.del(keyBaseName + i)))
Review comment:
Yes, that's correct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] nonbinaryprogrammer commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
nonbinaryprogrammer commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r628590932
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractDelIntegrationTest.java
##########
@@ -97,10 +95,9 @@ public void testConcurrentDel_differentClients() {
AtomicLong deletedCount = new AtomicLong();
new ConcurrentLoopingThreads(ITERATION_COUNT,
(i) -> deletedCount.addAndGet(jedis.del(keyBaseName + i)),
- (i) -> deletedCount.addAndGet(jedis2.del(keyBaseName + i)))
+ (i) -> deletedCount.addAndGet(jedis.del(keyBaseName + i)))
Review comment:
at one point we needed two jedis's to do things concurrently. is that no longer an issue with cluster mode? I have this same question about everywhere that you deleted jedis2 and/or jedis3.
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractScanIntegrationTest.java
##########
@@ -49,7 +49,7 @@ public void setUp() {
@After
public void tearDown() {
- jedis.flushAll();
+ flushAll();
jedis.close();
}
Review comment:
it looks to me like it's using JedisCluster, but maybe I'm missing something
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] sabbey37 commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629403702
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
##########
@@ -54,68 +55,71 @@ public void errors_givenWrongNumberOfArguments() {
@Test
public void givenSplat_withASCIIdata_returnsExpectedMatches() {
- jedis.set("string1", "v1");
- jedis.sadd("set1", "member1");
- jedis.hset("hash1", "key1", "field1");
- assertThat(jedis.keys("*")).containsExactlyInAnyOrder("string1", "set1", "hash1");
- assertThat(jedis.keys("s*")).containsExactlyInAnyOrder("string1", "set1");
- assertThat(jedis.keys("h*")).containsExactlyInAnyOrder("hash1");
- assertThat(jedis.keys("foo*")).isEmpty();
+ jedis.set("{K}string1", "v1");
+ jedis.sadd("{K}set1", "member1");
+ jedis.hset("{K}hash1", "key1", "field1");
+ assertThat(jedis.keys("{K}*")).containsExactlyInAnyOrder("{K}string1", "{K}set1", "{K}hash1");
+ assertThat(jedis.keys("{K}s*")).containsExactlyInAnyOrder("{K}string1", "{K}set1");
+ assertThat(jedis.keys("{K}h*")).containsExactlyInAnyOrder("{K}hash1");
+ assertThat(jedis.keys("{K}foo*")).isEmpty();
}
@Test
public void givenSplat_withBinaryData_returnsExpectedMatches() {
byte[] stringKey =
- new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g', '1'};
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g',
+ '1'};
byte[] value = new byte[] {'v', '1'};
jedis.set(stringKey, value);
- byte[] setKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
+ byte[] setKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
byte[] member = new byte[] {'m', '1'};
jedis.sadd(setKey, member);
- byte[] hashKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
- byte[] key = new byte[] {'k', 'e', 'y', '1'};
+ byte[] hashKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
+ byte[] key = new byte[] {'{', 1, '}', 'k', 'e', 'y', '1'};
jedis.hset(hashKey, key, value);
assertThat(jedis.exists(stringKey));
assertThat(jedis.exists(setKey));
assertThat(jedis.exists(hashKey));
Review comment:
Unrelated to your PR, but it looks like these `assertThat` lines (lines 82-84) don't verify anything at the moment. We need to add an `isTrue()` to all of them. You don't have to fix this as part of this PR though.
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
##########
@@ -54,68 +55,71 @@ public void errors_givenWrongNumberOfArguments() {
@Test
public void givenSplat_withASCIIdata_returnsExpectedMatches() {
- jedis.set("string1", "v1");
- jedis.sadd("set1", "member1");
- jedis.hset("hash1", "key1", "field1");
- assertThat(jedis.keys("*")).containsExactlyInAnyOrder("string1", "set1", "hash1");
- assertThat(jedis.keys("s*")).containsExactlyInAnyOrder("string1", "set1");
- assertThat(jedis.keys("h*")).containsExactlyInAnyOrder("hash1");
- assertThat(jedis.keys("foo*")).isEmpty();
+ jedis.set("{K}string1", "v1");
+ jedis.sadd("{K}set1", "member1");
+ jedis.hset("{K}hash1", "key1", "field1");
+ assertThat(jedis.keys("{K}*")).containsExactlyInAnyOrder("{K}string1", "{K}set1", "{K}hash1");
+ assertThat(jedis.keys("{K}s*")).containsExactlyInAnyOrder("{K}string1", "{K}set1");
+ assertThat(jedis.keys("{K}h*")).containsExactlyInAnyOrder("{K}hash1");
+ assertThat(jedis.keys("{K}foo*")).isEmpty();
}
@Test
public void givenSplat_withBinaryData_returnsExpectedMatches() {
byte[] stringKey =
- new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g', '1'};
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g',
+ '1'};
byte[] value = new byte[] {'v', '1'};
jedis.set(stringKey, value);
- byte[] setKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
+ byte[] setKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
byte[] member = new byte[] {'m', '1'};
jedis.sadd(setKey, member);
- byte[] hashKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
- byte[] key = new byte[] {'k', 'e', 'y', '1'};
+ byte[] hashKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
+ byte[] key = new byte[] {'{', 1, '}', 'k', 'e', 'y', '1'};
jedis.hset(hashKey, key, value);
assertThat(jedis.exists(stringKey));
assertThat(jedis.exists(setKey));
assertThat(jedis.exists(hashKey));
- assertThat(jedis.keys(new byte[] {'*'})).containsExactlyInAnyOrder(stringKey, setKey, hashKey);
- assertThat(jedis.keys(new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', '*'}))
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', '*'})).containsExactlyInAnyOrder(stringKey,
+ setKey, hashKey);
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', '*'}))
.containsExactlyInAnyOrder(stringKey, setKey);
- assertThat(jedis.keys(new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', '*'}))
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', '*'}))
.containsExactlyInAnyOrder(hashKey);
- assertThat(jedis.keys(new byte[] {'f', '*'})).isEmpty();
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', 'f', '*'})).isEmpty();
}
@Test
- public void givenBinaryValue_withExactMatch_preservesBinaryData()
- throws UnsupportedEncodingException {
- String chinese_utf16 = "子";
- byte[] utf16encodedBytes = chinese_utf16.getBytes("UTF-16");
+ public void givenBinaryValue_withExactMatch_preservesBinaryData() {
+ String chineseHashTag = "{子}";
+ byte[] utf8encodedBytes = chineseHashTag.getBytes(StandardCharsets.UTF_8);
Review comment:
I noticed this was switched to `UTF-8` from `UTF-16`. Do we need to add an additional test for UTF_16?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629420923
##########
File path: geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/key/DelNativeRedisAcceptanceTest.java
##########
@@ -16,17 +16,27 @@
package org.apache.geode.redis.internal.executor.key;
import org.junit.ClassRule;
+import org.junit.Test;
-import org.apache.geode.NativeRedisTestRule;
+import org.apache.geode.redis.NativeRedisClusterTestRule;
public class DelNativeRedisAcceptanceTest extends AbstractDelIntegrationTest {
@ClassRule
- public static NativeRedisTestRule redis = new NativeRedisTestRule();
+ public static NativeRedisClusterTestRule redis = new NativeRedisClusterTestRule();
@Override
public int getPort() {
- return redis.getPort();
+ return redis.getExposedPorts().get(0);
}
+ @Override
+ public void flushAll() {
+ redis.flushAll();
+ }
+
+ @Test
+ public void doNothing() {
+ // nothing done
+ }
Review comment:
Arg. Sorry, forgot to push
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #6447: GEODE-9220: Switch Redis key tests to use JedisCluster
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #6447:
URL: https://github.com/apache/geode/pull/6447#discussion_r629430538
##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
##########
@@ -54,68 +55,71 @@ public void errors_givenWrongNumberOfArguments() {
@Test
public void givenSplat_withASCIIdata_returnsExpectedMatches() {
- jedis.set("string1", "v1");
- jedis.sadd("set1", "member1");
- jedis.hset("hash1", "key1", "field1");
- assertThat(jedis.keys("*")).containsExactlyInAnyOrder("string1", "set1", "hash1");
- assertThat(jedis.keys("s*")).containsExactlyInAnyOrder("string1", "set1");
- assertThat(jedis.keys("h*")).containsExactlyInAnyOrder("hash1");
- assertThat(jedis.keys("foo*")).isEmpty();
+ jedis.set("{K}string1", "v1");
+ jedis.sadd("{K}set1", "member1");
+ jedis.hset("{K}hash1", "key1", "field1");
+ assertThat(jedis.keys("{K}*")).containsExactlyInAnyOrder("{K}string1", "{K}set1", "{K}hash1");
+ assertThat(jedis.keys("{K}s*")).containsExactlyInAnyOrder("{K}string1", "{K}set1");
+ assertThat(jedis.keys("{K}h*")).containsExactlyInAnyOrder("{K}hash1");
+ assertThat(jedis.keys("{K}foo*")).isEmpty();
}
@Test
public void givenSplat_withBinaryData_returnsExpectedMatches() {
byte[] stringKey =
- new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g', '1'};
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 't', 'r', 'i', 'n', 'g',
+ '1'};
byte[] value = new byte[] {'v', '1'};
jedis.set(stringKey, value);
- byte[] setKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
+ byte[] setKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', 'e', 't', '1'};
byte[] member = new byte[] {'m', '1'};
jedis.sadd(setKey, member);
- byte[] hashKey = new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
- byte[] key = new byte[] {'k', 'e', 'y', '1'};
+ byte[] hashKey =
+ new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', 'a', 's', 'h', '1'};
+ byte[] key = new byte[] {'{', 1, '}', 'k', 'e', 'y', '1'};
jedis.hset(hashKey, key, value);
assertThat(jedis.exists(stringKey));
assertThat(jedis.exists(setKey));
assertThat(jedis.exists(hashKey));
- assertThat(jedis.keys(new byte[] {'*'})).containsExactlyInAnyOrder(stringKey, setKey, hashKey);
- assertThat(jedis.keys(new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', '*'}))
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', '*'})).containsExactlyInAnyOrder(stringKey,
+ setKey, hashKey);
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 's', '*'}))
.containsExactlyInAnyOrder(stringKey, setKey);
- assertThat(jedis.keys(new byte[] {(byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', '*'}))
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', (byte) 0xac, (byte) 0xed, 0, 4, 0, 5, 'h', '*'}))
.containsExactlyInAnyOrder(hashKey);
- assertThat(jedis.keys(new byte[] {'f', '*'})).isEmpty();
+ assertThat(jedis.keys(new byte[] {'{', 1, '}', 'f', '*'})).isEmpty();
}
@Test
- public void givenBinaryValue_withExactMatch_preservesBinaryData()
- throws UnsupportedEncodingException {
- String chinese_utf16 = "子";
- byte[] utf16encodedBytes = chinese_utf16.getBytes("UTF-16");
+ public void givenBinaryValue_withExactMatch_preservesBinaryData() {
+ String chineseHashTag = "{子}";
+ byte[] utf8encodedBytes = chineseHashTag.getBytes(StandardCharsets.UTF_8);
Review comment:
I switched to UTF-8 because UTF-16 converts to at least one 16-bit value. So even just `{}` will convert to `0x0, 0x7b, 0x0, 0x7d`. So to calculate the hashtag correctly, we'd need to know it was UTF-16 to be able to match what's between the braces. Without knowing, we end up matching against a spurious `0x0` between the braces. I'm not quite sure what the original reason was for converting to UTF-16 here.
(UTF-8 includes ASCII chars as a subset so `{}` ends up being just `0x7b, 0x7d`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org