1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-30 18:01:53 +03:00

Test case for init first succesfull SST.

This commit is contained in:
Teemu Ollakka
2018-12-19 14:57:46 +02:00
parent a4ea80e11a
commit e5e5d409ed

View File

@ -79,6 +79,19 @@ namespace
wsrep::view bootstrap_view;
wsrep::view second_view;
void connect_in_view(const wsrep::view& view)
{
BOOST_REQUIRE(ss.connect("cluster", "local", "0", false) == 0);
ss.on_connect(view);
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
}
void prepare_for_sst()
{
ss.prepare_for_sst();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_joiner);
}
void final_view()
{
BOOST_REQUIRE(ss.state() != wsrep::server_state::s_disconnected);
@ -121,19 +134,6 @@ namespace
server_service.sst_before_init_ = true;
}
void connect_in_view(const wsrep::view& view)
{
BOOST_REQUIRE(ss.connect("cluster", "local", "0", false) == 0);
ss.on_connect(view);
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
}
void prepare_for_sst()
{
ss.prepare_for_sst();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_joiner);
}
void sst_received_action()
{
server_service.sync_point_enabled_ = "on_view_wait_initialized";
@ -428,6 +428,22 @@ BOOST_FIXTURE_TEST_CASE(server_state_init_first_boostrap,
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_synced);
}
BOOST_FIXTURE_TEST_CASE(server_state_init_first_join_with_sst,
init_first_server_fixture)
{
ss.initialized();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_initialized);
connect_in_view(second_view);
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
prepare_for_sst();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_joiner);
server_service.logged_view(second_view);
ss.sst_received(cc, wsrep::gtid(cluster_id, wsrep::seqno(2)), 0);
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_joined);
ss.on_sync();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_synced);
}
// Cycle from synced state to disconnected and back to synced. Server
// storage engines remain initialized.
BOOST_FIXTURE_TEST_CASE(