Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

# FEAT: Add test engine #867

Open
karczex opened this issue Dec 17, 2020 · 0 comments
Open

# FEAT: Add test engine #867

karczex opened this issue Dec 17, 2020 · 0 comments

Comments

@karczex
Copy link

karczex commented Dec 17, 2020

FEAT: Add test engine

Rationale

There is need for tests of error handling and statuses in pmemkv, and exceptions in bindings. Most generic approach is to implement engine, which may return error statuses on demand.

Description

New engine based which handle "magic keys and values" and return statuses accordingly.

Magic values may be inserted in such way:

put("method_name", "status")

which allows to configure test case, by simply putting kv pairs, and then calling adequate methods.

        s = kv->put("non_magic_string_key", "some_value") // returns pmem::kv::status::OK
        s = kv->put("get_all", "UNKNOWN_ERROR");  // returns pmem::kv::status::OK
        s = kv->put("put", "INVALID_ARGUMENT"); // returns  pmem::kv::status::INVALID_ARGUMENT
        s = kv->get_all([](string_view k, string_view v){ return 0;}) //retruns pmem::kv::status::UNKNOWN_ERROR 
        s = kv->put("get", "OUT_OF_MEMORY");  // returns pmem::kv::status::OK 
        s = kv->get("any_string", [](string_view v){return 0;});  // returns pmem::kv::status::OUT_OF_MEMORY

Statuses configuration should be also configured for transactions and iterators (when implemented)

API Changes

New engine.

Implementation details

Probably should be based on blackhole with some additional std::map for inserted magic kv pairs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants