Skip to content

Commit cf05c0d

Browse files
authored
fix test_entry to consider diffrerent allocator size classes (valkey-io#3416)
fixes: valkey-io#3200 --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
1 parent edce58c commit cf05c0d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/unit/test_entry.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ TEST_F(EntryTest, entryCreate) {
9797
}
9898

9999
/**
100-
* Test entryUpdate with various combinations of value and expiry changes:
100+
* Test entryUpdate with various combinations of value and expiry changes (Test will only run when jemalloc is used):
101101
* 1. Update only the value (keeping embedded)
102102
* 2. Update only the expiry (keeping embedded)
103103
* 3. Update both value and expiry (keeping embedded)
@@ -110,6 +110,9 @@ TEST_F(EntryTest, entryCreate) {
110110
* 10. Update entry to exactly the same allocation size
111111
*/
112112
TEST_F(EntryTest, entryUpdate) {
113+
#ifndef USE_JEMALLOC
114+
GTEST_SKIP() << "Test requires jemalloc";
115+
#endif
113116
// Create embedded entry
114117
sds value1 = sdsnew(SHORT_VALUE);
115118
sds field = sdsnew(SHORT_FIELD);
@@ -182,7 +185,7 @@ TEST_F(EntryTest, entryUpdate) {
182185
// Update the value so that memory usage is at least 3/4 of the current memory usage
183186
// Ensuring required_embedded_size > current_embedded_allocation_size * 3 / 4 without creating a new entry
184187
current_embedded_allocation_size = entryMemUsage(e10);
185-
sds value11 = sdsnew("yyyyyy");
188+
sds value11 = sdsnew("yyyyyyyyyyyy");
186189
sds value_copy11 = sdsdup(value11);
187190
long long expiry11 = expiry10;
188191
entry *e11 = entryUpdate(e10, value11, expiry11);
@@ -195,7 +198,7 @@ TEST_F(EntryTest, entryUpdate) {
195198
// Update the value so that memory usage is exactly equal to the current allocation size
196199
// Ensuring required_embedded_size == current_embedded_allocation_size without creating a new entry
197200
current_embedded_allocation_size = entryMemUsage(e11);
198-
sds value12 = sdsnew("zzzzzz");
201+
sds value12 = sdsnew("zzzzzzzzzzzz");
199202
sds value_copy12 = sdsdup(value12);
200203
long long expiry12 = expiry11;
201204
entry *e12 = entryUpdate(e11, value12, expiry12);

0 commit comments

Comments
 (0)