1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

Tests for transaction context, server context state strings.

This commit is contained in:
Teemu Ollakka
2018-06-13 17:24:37 +03:00
parent 3cd7a11cb2
commit 39c9ef8a63
2 changed files with 70 additions and 0 deletions

View File

@ -83,3 +83,27 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc_rollback,
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted);
} }
BOOST_AUTO_TEST_CASE(server_context_state_strings)
{
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_disconnected) == "disconnected");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_initializing) == "initilizing");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_initialized) == "initilized");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_connected) == "connected");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_joiner) == "joiner");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_joined) == "joined");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_donor) == "donor");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_synced) == "synced");
BOOST_REQUIRE(wsrep::to_string(
wsrep::server_context::s_disconnecting) == "disconnecting");
BOOST_REQUIRE(wsrep::to_string(
static_cast<enum wsrep::server_context::state>(0xff)) == "unknown");
}

View File

@ -1148,3 +1148,49 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_cert_fail,
BOOST_REQUIRE(sc.provider().start_fragments() == 0); BOOST_REQUIRE(sc.provider().start_fragments() == 0);
BOOST_REQUIRE(sc.provider().rollback_fragments() == 0); BOOST_REQUIRE(sc.provider().rollback_fragments() == 0);
} }
///////////////////////////////////////////////////////////////////////////////
// misc //
///////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(transaction_context_state_strings)
{
BOOST_REQUIRE(wsrep::to_string(
wsrep::transaction_context::s_executing) == "executing");
BOOST_REQUIRE(wsrep::to_string(
wsrep::transaction_context::s_preparing) == "preparing");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_certifying) == "certifying");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_committing) == "committing");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_ordered_commit) == "ordered_commit");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_committed) == "committed");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_cert_failed) == "cert_failed");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_must_abort) == "must_abort");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_aborting) == "aborting");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_aborted) == "aborted");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_must_replay) == "must_replay");
BOOST_REQUIRE(
wsrep::to_string(
wsrep::transaction_context::s_replaying) == "replaying");
BOOST_REQUIRE(
wsrep::to_string(
static_cast<enum wsrep::transaction_context::state>(0xff)) == "unknown");
}