diff --git a/test/test_utils.cpp b/test/test_utils.cpp index a0ea72b..3646e96 100644 --- a/test/test_utils.cpp +++ b/test/test_utils.cpp @@ -43,3 +43,28 @@ void wsrep_test::bf_abort_provider(wsrep::mock_server_state& sc, sc.provider().bf_abort(bf_seqno, tc.id(), victim_seqno); (void)victim_seqno; } + +void wsrep_test::terminate_streaming_applier( + wsrep::mock_server_state& sc, + const wsrep::id& server_id, + wsrep::transaction_id transaction_id) +{ + // Note that all other arguments than server_id and + // transaction_id are chosen arbitrarily and it is hoped + // that the mock implementation does not freak out about it. + wsrep::mock_client mc(sc, wsrep::client_id(10), + wsrep::client_state::m_high_priority); + mc.open(wsrep::client_id(10)); + mc.before_command(); + wsrep::mock_high_priority_service hps(sc, &mc, false); + wsrep::ws_handle ws_handle(transaction_id, (void*)(1)); + wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("cluster1"), + wsrep::seqno(100)), + wsrep::stid(server_id, + transaction_id, + wsrep::client_id(1)), + wsrep::seqno(0), + wsrep::provider::flag::rollback); + wsrep::const_buffer data(0, 0); + sc.on_apply(hps, ws_handle, ws_meta, data); +} diff --git a/test/test_utils.hpp b/test/test_utils.hpp index d04e5ca..69ce700 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -43,4 +43,10 @@ namespace wsrep_test void bf_abort_provider(wsrep::mock_server_state& sc, const wsrep::transaction& tc, wsrep::seqno bf_seqno); + + // Terminate streaming applier by applying rollback fragment. + void terminate_streaming_applier( + wsrep::mock_server_state& sc, + const wsrep::id& server_id, + wsrep::transaction_id transaction_id); } diff --git a/test/transaction_test.cpp b/test/transaction_test.cpp index 5a6d1bc..915d9db 100644 --- a/test/transaction_test.cpp +++ b/test/transaction_test.cpp @@ -1112,6 +1112,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_1pc_bf_abort_during_fragment_remov BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.after_statement()); BOOST_REQUIRE(tc.active() == false); + wsrep_test::terminate_streaming_applier(sc, sc.id(), + wsrep::transaction_id(1)); } // @@ -1154,6 +1156,9 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_executing, BOOST_REQUIRE(cc.before_rollback() == 0); BOOST_REQUIRE(cc.after_rollback() == 0); BOOST_REQUIRE(cc.after_statement()); + wsrep_test::terminate_streaming_applier(sc, sc.id(), + wsrep::transaction_id(1)); + } // // Test streaming certification failure during fragment replication diff --git a/test/transaction_test_2pc.cpp b/test/transaction_test_2pc.cpp index 9e8ee5e..a8f3a0d 100644 --- a/test/transaction_test_2pc.cpp +++ b/test/transaction_test_2pc.cpp @@ -258,6 +258,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_bf_abort_during_fragment_remov BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.after_statement()); BOOST_REQUIRE(tc.active() == false); + wsrep_test::terminate_streaming_applier(sc, sc.id(), + wsrep::transaction_id(1)); } ///////////////////////////////////////////////////////////////////////////////