Skip to content

Commit 80650a7

Browse files
committed
MB-30167: Make test_create_new_checkpoint more robust
This test intermittently fails with the following error: Test failed: `' (Expected `3', got `4' - Last closed checkpoint Id for VB 0 should be 3) The test itself seems correct, however it lacks a number of intermediate checks; the final check of the checkpoint IDs could have differed in a number of places ealier. Re-write the test to be more strict / controlled; which should hopefully avoid any intermitent failures. Change-Id: I6dc7e3f441b12a2ec1d92ab0df6eabbec2035139 Reviewed-on: http://review.couchbase.org/95812 Reviewed-by: Tim Bradgate <[email protected]> Well-Formed: Build Bot <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 9df3480 commit 80650a7

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

engines/ep/tests/ep_testsuite_checkpoint.cc

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,27 @@
2929
// Testcases //////////////////////////////////////////////////////////////////
3030

3131
static enum test_result test_create_new_checkpoint(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
32-
// Inserting more than 500 items will cause a new open checkpoint with id 2
33-
// to be created.
32+
// Inserting more than 5 items (see testcase config) will cause a new open
33+
// checkpoint with id 2 to be created.
3434

35-
for (int j = 0; j < 600; ++j) {
36-
std::stringstream ss;
37-
ss << "key" << j;
38-
item *i;
39-
checkeq(ENGINE_SUCCESS,
40-
store(h, h1, NULL, OPERATION_SET, ss.str().c_str(),
41-
ss.str().c_str(), &i, 0, 0),
42-
"Failed to store a value");
43-
h1->release(h, i);
44-
}
35+
write_items(h, h1, 5);
36+
wait_for_flusher_to_settle(h, h1);
37+
38+
checkeq(1,
39+
get_int_stat(
40+
h, h1, "vb_0:last_closed_checkpoint_id", "checkpoint 0"),
41+
"Last closed checkpoint Id for VB 0 should still be 1 after "
42+
"storing 50 items");
43+
44+
// Store 1 more - should push it over to the next checkpoint.
45+
write_items(h, h1, 1, 5);
46+
wait_for_flusher_to_settle(h, h1);
47+
48+
checkeq(2,
49+
get_int_stat(
50+
h, h1, "vb_0:last_closed_checkpoint_id", "checkpoint 0"),
51+
"Last closed checkpoint Id for VB 0 should increase to 2 after "
52+
"storing 51 items");
4553

4654
createCheckpoint(h, h1);
4755
checkeq(PROTOCOL_BINARY_RESPONSE_SUCCESS, last_status.load(),
@@ -257,7 +265,7 @@ BaseTestCase testsuite_testcases[] = {
257265
test_create_new_checkpoint,
258266
test_setup,
259267
teardown,
260-
"chk_max_items=500;item_num_based_new_chk=true",
268+
"chk_max_items=5;item_num_based_new_chk=true",
261269
prepare,
262270
cleanup),
263271
TestCase("checkpoint: validate checkpoint config params",

0 commit comments

Comments
 (0)