jdeppe-pivotal commented on a change in pull request #6997:
URL: https://github.com/apache/geode/pull/6997#discussion_r728936222



##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZInterStoreIntegrationTest.java
##########
@@ -189,6 +189,40 @@ public void shouldError_givenNumKeysNotAnInteger() {
             .hasMessage("ERR " + RedisConstants.ERROR_NOT_INTEGER);
   }
 
+  @Test
+  public void shouldNotCreateDestinationKey_givenTargetSetIsEmpty() {
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+    assertThat(jedis.zinterstore(NEW_SET, KEY1)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void 
shouldDeleteDestinationKey_givenDestinationExistsAndTargetSetIsEmpty() {
+    jedis.zadd(NEW_SET, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isTrue();

Review comment:
       This also does not seem necessary.

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZInterStoreIntegrationTest.java
##########
@@ -189,6 +189,40 @@ public void shouldError_givenNumKeysNotAnInteger() {
             .hasMessage("ERR " + RedisConstants.ERROR_NOT_INTEGER);
   }
 
+  @Test
+  public void shouldNotCreateDestinationKey_givenTargetSetIsEmpty() {
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+    assertThat(jedis.zinterstore(NEW_SET, KEY1)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void 
shouldDeleteDestinationKey_givenDestinationExistsAndTargetSetIsEmpty() {
+    jedis.zadd(NEW_SET, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isTrue();
+
+    assertThat(jedis.zinterstore(NEW_SET, KEY1)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void shouldNotCreateDestinationKey_givenAtLeastOneTargetSetIsEmpty() {
+    jedis.zadd(KEY1, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+    assertThat(jedis.zinterstore(NEW_SET, KEY1, KEY2)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void 
shouldDeleteDestinationKey_givenDestinationExistsAndAtLeastOneTargetSetIsEmpty()
 {
+    jedis.zadd(NEW_SET, 1.0, "member");
+    jedis.zadd(KEY1, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isTrue();

Review comment:
       Ditto

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZInterStoreIntegrationTest.java
##########
@@ -189,6 +189,40 @@ public void shouldError_givenNumKeysNotAnInteger() {
             .hasMessage("ERR " + RedisConstants.ERROR_NOT_INTEGER);
   }
 
+  @Test
+  public void shouldNotCreateDestinationKey_givenTargetSetIsEmpty() {
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+    assertThat(jedis.zinterstore(NEW_SET, KEY1)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void 
shouldDeleteDestinationKey_givenDestinationExistsAndTargetSetIsEmpty() {
+    jedis.zadd(NEW_SET, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isTrue();
+
+    assertThat(jedis.zinterstore(NEW_SET, KEY1)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void shouldNotCreateDestinationKey_givenAtLeastOneTargetSetIsEmpty() {
+    jedis.zadd(KEY1, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isFalse();

Review comment:
       Is this needed?

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZUnionStoreIntegrationTest.java
##########
@@ -176,6 +176,22 @@ public void shouldError_givenMultipleAggregates() {
                 .hasMessage("ERR " + RedisConstants.ERROR_SYNTAX);
   }
 
+  @Test
+  public void shouldNotCreateDestinationKey_givenTargetSetIsEmpty() {
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+    assertThat(jedis.zunionstore(NEW_SET, KEY1)).isZero();
+    assertThat(jedis.exists(NEW_SET)).isFalse();
+  }
+
+  @Test
+  public void 
shouldDeleteDestinationKey_givenDestinationExistsAndTargetSetIsEmpty() {
+    jedis.zadd(NEW_SET, 1.0, "member");
+    assertThat(jedis.exists(NEW_SET)).isTrue();

Review comment:
       Ditto

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZInterStoreIntegrationTest.java
##########
@@ -189,6 +189,40 @@ public void shouldError_givenNumKeysNotAnInteger() {
             .hasMessage("ERR " + RedisConstants.ERROR_NOT_INTEGER);
   }
 
+  @Test
+  public void shouldNotCreateDestinationKey_givenTargetSetIsEmpty() {
+    assertThat(jedis.exists(NEW_SET)).isFalse();

Review comment:
       I don't think you need to assert this state at the start of the test.

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZUnionStoreIntegrationTest.java
##########
@@ -176,6 +176,22 @@ public void shouldError_givenMultipleAggregates() {
                 .hasMessage("ERR " + RedisConstants.ERROR_SYNTAX);
   }
 
+  @Test
+  public void shouldNotCreateDestinationKey_givenTargetSetIsEmpty() {
+    assertThat(jedis.exists(NEW_SET)).isFalse();

Review comment:
       Ditto




-- 
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]


Reply via email to