Skip to content

Commit

Permalink
Split system_tests into multiple suites so that they can run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 committed Jun 13, 2024
1 parent 0369bef commit 39249ae
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions tests/eosio.system_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ FC_REFLECT( connector, (balance)(weight) );

using namespace eosio_system;

BOOST_AUTO_TEST_SUITE(eosio_system_tests)

bool within_error(int64_t a, int64_t b, int64_t err) { return std::abs(a - b) <= err; };
bool within_one(int64_t a, int64_t b) { return within_error(a, b, 1); }

// Split the tests into multiple suites so that they can run in parallel in CICD to
// reduce overall CICD time..
// Each suite is grouped by functionality and takes approximately the same amount of time.

BOOST_AUTO_TEST_SUITE(eosio_system_stake_tests)

BOOST_FIXTURE_TEST_CASE( buysell, eosio_system_tester ) try {

BOOST_REQUIRE_EQUAL( core_sym::from_string("0.0000"), get_balance( "alice1111111" ) );
Expand Down Expand Up @@ -743,6 +747,9 @@ BOOST_FIXTURE_TEST_CASE( stake_to_another_user_not_from_refund, eosio_system_tes

} FC_LOG_AND_RETHROW()

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(eosio_system_producer_tests)

// Tests for voting
BOOST_FIXTURE_TEST_CASE( producer_register_unregister, eosio_system_tester ) try {
issue_and_transfer( "alice1111111", core_sym::from_string("1000.0000"), config::system_account_name );
Expand Down Expand Up @@ -1640,6 +1647,9 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
}
} FC_LOG_AND_RETHROW()

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(eosio_system_inflation_tests)

BOOST_FIXTURE_TEST_CASE(change_inflation, eosio_system_tester) try {

{
Expand Down Expand Up @@ -1773,6 +1783,9 @@ BOOST_AUTO_TEST_CASE(extreme_inflation) try {
BOOST_REQUIRE_EQUAL(t.wasm_assert_msg("quantity exceeds available supply"), t.push_action("defproducera"_n, "claimrewards"_n, mvo()("owner", "defproducera")));
} FC_LOG_AND_RETHROW()

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(eosio_system_multiple_producer_pay_tests)

BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::unit_test::tolerance(1e-10)) try {

const int64_t secs_per_year = 52 * 7 * 24 * 3600;
Expand Down Expand Up @@ -2152,6 +2165,9 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
} FC_LOG_AND_RETHROW()


BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(eosio_system_votepay_tests)

BOOST_FIXTURE_TEST_CASE(multiple_producer_votepay_share, eosio_system_tester, * boost::unit_test::tolerance(1e-10)) try {

const asset net = core_sym::from_string("80.0000");
Expand Down Expand Up @@ -2850,9 +2866,6 @@ BOOST_FIXTURE_TEST_CASE(producers_upgrade_system_contract, eosio_system_tester)
BOOST_REQUIRE( bool(trace) );
BOOST_REQUIRE_EQUAL( 1, trace->action_traces.size() );
BOOST_REQUIRE_EQUAL( transaction_receipt::executed, trace->receipt->status );

produce_blocks( 250 );

} FC_LOG_AND_RETHROW()

BOOST_FIXTURE_TEST_CASE(producer_onblock_check, eosio_system_tester) try {
Expand Down Expand Up @@ -3246,6 +3259,9 @@ BOOST_FIXTURE_TEST_CASE( elect_producers /*_and_parameters*/, eosio_system_teste
} FC_LOG_AND_RETHROW()


BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(eosio_system_name_tests)

BOOST_FIXTURE_TEST_CASE( buyname, eosio_system_tester ) try {
create_accounts_with_resources( { "dan"_n, "sam"_n } );
transfer( config::system_account_name, "dan", core_sym::from_string( "10000.0000" ) );
Expand Down Expand Up @@ -3889,6 +3905,9 @@ BOOST_FIXTURE_TEST_CASE( ram_gift, eosio_system_tester ) try {

} FC_LOG_AND_RETHROW()

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(eosio_system_rex_tests)

BOOST_FIXTURE_TEST_CASE( rex_rounding_issue, eosio_system_tester ) try {
const std::vector<name> whales { "whale1"_n, "whale2"_n, "whale3"_n, "whale4"_n , "whale5"_n };
const name bob{ "bob"_n }, alice{ "alice"_n };
Expand Down

0 comments on commit 39249ae

Please sign in to comment.