1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-27 09:01:50 +03:00

Changed project name to wsrep-lib.

This commit is contained in:
Teemu Ollakka
2018-06-03 21:56:28 +03:00
parent 188bda1339
commit d3cb537d1e
37 changed files with 730 additions and 730 deletions

View File

@ -10,76 +10,76 @@
// Test on_apply() method for 1pc
BOOST_AUTO_TEST_CASE(server_context_applying_1pc)
{
trrep::mock_server_context sc("s1", "s1",
trrep::server_context::rm_sync);
trrep::mock_client_context cc(sc,
trrep::client_id(1),
trrep::client_context::m_applier,
wsrep::mock_server_context sc("s1", "s1",
wsrep::server_context::rm_sync);
wsrep::mock_client_context cc(sc,
wsrep::client_id(1),
wsrep::client_context::m_applier,
false);
trrep_mock::start_applying_transaction(
wsrep_mock::start_applying_transaction(
cc, 1, 1,
WSREP_FLAG_TRX_START | WSREP_FLAG_TRX_END);
char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, trrep::data(buf, 1)) == 0);
const trrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == trrep::transaction_context::s_committed);
BOOST_REQUIRE(sc.on_apply(cc, wsrep::data(buf, 1)) == 0);
const wsrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_committed);
}
// Test on_apply() method for 2pc
BOOST_AUTO_TEST_CASE(server_context_applying_2pc)
{
trrep::mock_server_context sc("s1", "s1",
trrep::server_context::rm_sync);
trrep::mock_client_context cc(sc,
trrep::client_id(1),
trrep::client_context::m_applier,
wsrep::mock_server_context sc("s1", "s1",
wsrep::server_context::rm_sync);
wsrep::mock_client_context cc(sc,
wsrep::client_id(1),
wsrep::client_context::m_applier,
true);
trrep_mock::start_applying_transaction(
wsrep_mock::start_applying_transaction(
cc, 1, 1,
WSREP_FLAG_TRX_START | WSREP_FLAG_TRX_END);
char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, trrep::data(buf, 1)) == 0);
const trrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == trrep::transaction_context::s_committed);
BOOST_REQUIRE(sc.on_apply(cc, wsrep::data(buf, 1)) == 0);
const wsrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_committed);
}
// Test on_apply() method for 1pc transaction which
// fails applying and rolls back
BOOST_AUTO_TEST_CASE(server_context_applying_1pc_rollback)
{
trrep::mock_server_context sc("s1", "s1",
trrep::server_context::rm_sync);
trrep::mock_client_context cc(sc,
trrep::client_id(1),
trrep::client_context::m_applier,
wsrep::mock_server_context sc("s1", "s1",
wsrep::server_context::rm_sync);
wsrep::mock_client_context cc(sc,
wsrep::client_id(1),
wsrep::client_context::m_applier,
false);
cc.fail_next_applying(true);
trrep_mock::start_applying_transaction(
wsrep_mock::start_applying_transaction(
cc, 1, 1,
WSREP_FLAG_TRX_START | WSREP_FLAG_TRX_END);
char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, trrep::data(buf, 1)) == 1);
const trrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == trrep::transaction_context::s_aborted);
BOOST_REQUIRE(sc.on_apply(cc, wsrep::data(buf, 1)) == 1);
const wsrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted);
}
// Test on_apply() method for 2pc transaction which
// fails applying and rolls back
BOOST_AUTO_TEST_CASE(server_context_applying_2pc_rollback)
{
trrep::mock_server_context sc("s1", "s1",
trrep::server_context::rm_sync);
trrep::mock_client_context cc(sc,
trrep::client_id(1),
trrep::client_context::m_applier,
wsrep::mock_server_context sc("s1", "s1",
wsrep::server_context::rm_sync);
wsrep::mock_client_context cc(sc,
wsrep::client_id(1),
wsrep::client_context::m_applier,
true);
cc.fail_next_applying(true);
trrep_mock::start_applying_transaction(
wsrep_mock::start_applying_transaction(
cc, 1, 1,
WSREP_FLAG_TRX_START | WSREP_FLAG_TRX_END);
char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, trrep::data(buf, 1)) == 1);
const trrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == trrep::transaction_context::s_aborted);
BOOST_REQUIRE(sc.on_apply(cc, wsrep::data(buf, 1)) == 1);
const wsrep::transaction_context& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted);
}