jdeppe-pivotal commented on a change in pull request #6877:
URL: https://github.com/apache/geode/pull/6877#discussion_r719443371
##########
File path:
geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractRenameIntegrationTest.java
##########
@@ -188,38 +245,39 @@ public void
shouldNotDeadlock_concurrentRenames_givenStripeContention()
}
@Test
- public void shouldThrowError_givenKeyDeletedDuringRename()
- throws ExecutionException, InterruptedException {
- CyclicBarrier startCyclicBarrier = new CyclicBarrier(2);
- ExecutorService pool = Executors.newFixedThreadPool(2);
-
- for (int i = 0; i < 100; i++) {
- jedis.set("{user1}oldKey", "foo");
+ public void shouldError_givenKeyDeletedDuringRename() {
+ int iterations = 2000;
- Runnable renameOldKeyToNewKey = () -> {
- cyclicBarrierAwait(startCyclicBarrier);
+ final AtomicReference<RuntimeException> renameException = new
AtomicReference<>(null);
- jedis.rename("{user1}oldKey", "{user1}newKey");
- };
+ jedis.set("{user1}oldKey", "foo");
- Runnable deleteOldKey = () -> {
- cyclicBarrierAwait(startCyclicBarrier);
- jedis.del("{user1}oldKey");
- };
-
- Future<?> future1 = pool.submit(renameOldKeyToNewKey);
- Future<?> future2 = pool.submit(deleteOldKey);
-
- try {
- future1.get();
- assertThat(jedis.get("{user1}newKey")).isEqualTo("foo");
- } catch (Exception e) {
- assertThat(e).hasMessageContaining("no such key");
- }
- future2.get();
-
- assertThat(jedis.get("{user1}oldKey")).isNull();
+ try {
+ new ConcurrentLoopingThreads(iterations,
Review comment:
This test still ends up only running a single iteration since an
exception causes it to end. That wasn't the intent of the original test.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]