Skip to content

Commit

Permalink
MB-21539: Use correct expiry value for test 'MB-16357'
Browse files Browse the repository at this point in the history
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 <trond.norbye@gmail.com>
Tested-by: buildbot <build@couchbase.com>
  • Loading branch information
daverigby committed Nov 2, 2016
1 parent 4f05fe1 commit 8e98386
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/ep_test_apis.cc
Expand Up @@ -1459,10 +1459,9 @@ void validate_store_resp(ENGINE_ERROR_CODE ret, int& num_items)
}
}

/* Helper function to write unique "num_items" starting from keyXX
(XX is start_seqno) */
void write_items(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1, int num_items,
int start_seqno, const char *key_prefix, const char *value)
int start_seqno, const char *key_prefix, const char *value,
uint32_t expiry)
{
int j = 0;
while (1) {
Expand All @@ -1472,7 +1471,8 @@ void write_items(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1, int num_items,
item *i = nullptr;
std::string key(key_prefix + std::to_string(j + start_seqno));
ENGINE_ERROR_CODE ret = store(h, h1, nullptr, OPERATION_SET,
key.c_str(), value, &i);
key.c_str(), value, &i, /*cas*/0, /*vb*/0,
expiry);
h1->release(h, nullptr, i);
validate_store_resp(ret, j);
}
Expand Down
14 changes: 11 additions & 3 deletions tests/ep_test_apis.h
Expand Up @@ -401,11 +401,19 @@ void set_degraded_mode(ENGINE_HANDLE *h,
const void* cookie,
bool enable);

/* Helper function to write unique "num_items" starting from keyXX
(XX is start_seqno) */
/**
* Helper function to write unique "num_items" starting from {key_prefix}XX,
* where XX is start_seqno.
* @param num_items Number of items to write
* @param start_seqno Sequence number to start from (inclusive).
* @param key_prefix Prefix for key names
* @param value Value for each item
* @param expiry Expiration time for each item.
*/
void write_items(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1,
int num_items, int start_seqno = 0,
const char *key_prefix = "key", const char *value = "data");
const char *key_prefix = "key", const char *value = "data",
uint32_t expiry = 0);

/* Helper function to write unique items starting from keyXX until memory usage
hits "mem_thresh_perc" (XX is start_seqno) */
Expand Down
2 changes: 1 addition & 1 deletion tests/ep_testsuite_dcp.cc
Expand Up @@ -5008,7 +5008,7 @@ static enum test_result test_mb16357(ENGINE_HANDLE *h,
// Load up vb0 with n items, expire in 1 second
const int num_items = 1000;

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

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

0 comments on commit 8e98386

Please sign in to comment.