Skip to content

Commit

Permalink
tests: add crc checking by overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
maxux committed May 31, 2024
1 parent f10d1b1 commit d487000
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/zdb_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,39 @@ runtest_prio(110, default_get_deleted) {
return zdb_command_error(test, argvsz(argv), argv);
}

runtest_prio(110, default_set_prepare_overwrite) {
if(test->mode == SEQUENTIAL)
return TEST_SKIPPED;

return zdb_set(test, "crcoverwrite", "HelloWorld");
}

runtest_prio(110, default_set_overwrite) {
if(test->mode == SEQUENTIAL)
return TEST_SKIPPED;

redisReply *reply;

if(!(reply = redisCommand(test->zdb, "SET %s %s", "crcoverwrite", "HelloWorld")))
return zdb_result(reply, TEST_FAILED_FATAL);

// should not update the data and should not memory leak
// zdb should returns NULL to notify data were not updated
if(reply->type != REDIS_REPLY_NIL) {
log("%s\n", reply->str);
return zdb_result(reply, TEST_FAILED_FATAL);
}

return zdb_result(reply, TEST_SUCCESS);
}

runtest_prio(110, default_check_overwrite) {
if(test->mode == SEQUENTIAL)
return TEST_SKIPPED;

return zdb_check(test, "crcoverwrite", "HelloWorld");
}

//
// basic GET/SET/DEL on default set
// sequential mode
Expand Down

0 comments on commit d487000

Please sign in to comment.