sabbey37 commented on a change in pull request #6296:
URL: https://github.com/apache/geode/pull/6296#discussion_r615142156
##########
File path:
geode-apis-compatible-with-redis/src/test/java/org/apache/geode/redis/internal/data/RedisHashTest.java
##########
@@ -258,6 +258,13 @@ public void hscanSnaphots_shouldExpireAfterExpiryPeriod() {
});
}
+ @Test
+ public void
hashSizeOverhead_shouldNotBeChanged_withoutForethoughtAndTesting() {
+ assertThat(RedisHash.PER_OBJECT_OVERHEAD).isEqualTo(8);
+
assertThat(RedisHash.getPerStringOverhead()).isEqualTo(RedisHash.PER_OBJECT_OVERHEAD
+ 46);
+
assertThat(RedisHash.getPerHashOverhead()).isEqualTo(RedisHash.PER_OBJECT_OVERHEAD
+ 116);
+ }
Review comment:
Could we do more direct unit testing in the `RedisHashTest.java`, maybe
something like:
```
assertThat(ros.sizeof(new
RedisHash())).isEqualTo(RedisHash.getPerHashOverhead());
assertThat(ros.sizeof(new RedisHash(createListOfDataElements(1))))
.isEqualTo(RedisHash.getPerHashOverhead() +
(RedisHash.getPerStringOverhead() * 2));
```
...and something similar in `RedisStringTest.java` and `RedisSetTest.java`
...it should be noted that the above assertions currently fail though, so
maybe that's not the correct way to test it. How did we originally derive the
`PER_HASH_OVERHEAD` and `PER_STRING_OVERHEAD`? @upthewaterspout what is the
proper way to derive and test those constants?
--
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:
[email protected]