Skip to content

Commit 8e98386

Browse files
committed
MB-21539: Use correct expiry value for test 'MB-16357'
During the refactor done in b4c858e, the expiration value of 1s was lost for this test. Restore it. Change-Id: I0b1bf35548cffcd6867a29dcbb9a843b0f06b4c8 Reviewed-on: http://review.couchbase.org/69365 Reviewed-by: Trond Norbye <[email protected]> Tested-by: buildbot <[email protected]>
1 parent 4f05fe1 commit 8e98386

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

tests/ep_test_apis.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,10 +1459,9 @@ void validate_store_resp(ENGINE_ERROR_CODE ret, int& num_items)
14591459
}
14601460
}
14611461

1462-
/* Helper function to write unique "num_items" starting from keyXX
1463-
(XX is start_seqno) */
14641462
void write_items(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1, int num_items,
1465-
int start_seqno, const char *key_prefix, const char *value)
1463+
int start_seqno, const char *key_prefix, const char *value,
1464+
uint32_t expiry)
14661465
{
14671466
int j = 0;
14681467
while (1) {
@@ -1472,7 +1471,8 @@ void write_items(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1, int num_items,
14721471
item *i = nullptr;
14731472
std::string key(key_prefix + std::to_string(j + start_seqno));
14741473
ENGINE_ERROR_CODE ret = store(h, h1, nullptr, OPERATION_SET,
1475-
key.c_str(), value, &i);
1474+
key.c_str(), value, &i, /*cas*/0, /*vb*/0,
1475+
expiry);
14761476
h1->release(h, nullptr, i);
14771477
validate_store_resp(ret, j);
14781478
}

tests/ep_test_apis.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,19 @@ void set_degraded_mode(ENGINE_HANDLE *h,
401401
const void* cookie,
402402
bool enable);
403403

404-
/* Helper function to write unique "num_items" starting from keyXX
405-
(XX is start_seqno) */
404+
/**
405+
* Helper function to write unique "num_items" starting from {key_prefix}XX,
406+
* where XX is start_seqno.
407+
* @param num_items Number of items to write
408+
* @param start_seqno Sequence number to start from (inclusive).
409+
* @param key_prefix Prefix for key names
410+
* @param value Value for each item
411+
* @param expiry Expiration time for each item.
412+
*/
406413
void write_items(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1,
407414
int num_items, int start_seqno = 0,
408-
const char *key_prefix = "key", const char *value = "data");
415+
const char *key_prefix = "key", const char *value = "data",
416+
uint32_t expiry = 0);
409417

410418
/* Helper function to write unique items starting from keyXX until memory usage
411419
hits "mem_thresh_perc" (XX is start_seqno) */

tests/ep_testsuite_dcp.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5008,7 +5008,7 @@ static enum test_result test_mb16357(ENGINE_HANDLE *h,
50085008
// Load up vb0 with n items, expire in 1 second
50095009
const int num_items = 1000;
50105010

5011-
write_items(h, h1, num_items, 0, "key-");
5011+
write_items(h, h1, num_items, 0, "key-", "value", /*expiration*/1);
50125012

50135013
wait_for_flusher_to_settle(h, h1);
50145014
testHarness.time_travel(3617); // force expiry pushing time forward.

0 commit comments

Comments
 (0)