Skip to content

Commit

Permalink
Merge pull request #95 from AntelopeIO/fix_failures_by_default_tester
Browse files Browse the repository at this point in the history
Fix test failures under default Savanna libtester
  • Loading branch information
linh2931 authored Jun 4, 2024
2 parents cd645b5 + 9d4d6cd commit 229dd4f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion tests/eosio.bios_inst_fin_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace fc;
using mvo = fc::mutable_variant_object;

// tests for instant finality actions
class eosio_bios_if_tester : public tester {
class eosio_bios_if_tester : public legacy_tester {
public:

eosio_bios_if_tester() {
Expand Down
2 changes: 1 addition & 1 deletion tests/eosio.limitauth_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inline const auto bob = "bob111111111"_n;
struct limitauth_tester: eosio_system_tester {
action_result push_action(name code, name action, permission_level auth, const variant_object& data) {
try {
TESTER::push_action(code, action, {auth}, data);
validating_tester::push_action(code, action, {auth}, data);
return "";
} catch (const fc::exception& ex) {
edump((ex.to_detail_string()));
Expand Down
7 changes: 6 additions & 1 deletion tests/eosio.powerup_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ using namespace eosio_system;

struct powerup_tester : eosio_system_tester {

powerup_tester() { create_accounts_with_resources({ "eosio.reserv"_n }); }
// Use full_except_do_not_transition_to_savanna for now until
// https://github.com/AntelopeIO/reference-contracts/issues/91 is resolved
powerup_tester()
: eosio_system_tester(setup_level::full, setup_policy::full_except_do_not_transition_to_savanna) {
create_accounts_with_resources({ "eosio.reserv"_n });
}

void start_rex() {
create_account_with_resources("rexholder111"_n, config::system_account_name, core_sym::from_string("1.0000"),
Expand Down
15 changes: 4 additions & 11 deletions tests/eosio.system_tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ using namespace fc;

using mvo = fc::mutable_variant_object;

#ifndef TESTER
#ifdef NON_VALIDATING_TEST
#define TESTER tester
#else
#define TESTER validating_tester
#endif
#endif

namespace eosio_system {

class eosio_system_tester : public TESTER {
class eosio_system_tester : public validating_tester {
public:

void basic_setup() {
Expand Down Expand Up @@ -91,7 +83,8 @@ class eosio_system_tester : public TESTER {
full
};

eosio_system_tester( setup_level l = setup_level::full ) {
eosio_system_tester( setup_level l = setup_level::full, setup_policy policy = setup_policy::full )
: validating_tester({}, nullptr, policy) {
if( l == setup_level::none ) return;

basic_setup();
Expand Down Expand Up @@ -1315,7 +1308,7 @@ class eosio_system_tester : public TESTER {
}
produce_blocks( 250);

auto trace_auth = TESTER::push_action(config::system_account_name, updateauth::get_name(), config::system_account_name, mvo()
auto trace_auth = validating_tester::push_action(config::system_account_name, updateauth::get_name(), config::system_account_name, mvo()
("account", name(config::system_account_name).to_string())
("permission", name(config::active_name).to_string())
("parent", name(config::owner_name).to_string())
Expand Down
10 changes: 7 additions & 3 deletions tests/eosio.system_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ BOOST_FIXTURE_TEST_CASE( producer_wtmsig, eosio_system_tester ) try {

produce_block();
produce_block( fc::minutes(2) );
produce_blocks(2);
produce_blocks(config::producer_repetitions * 2);
BOOST_REQUIRE_EQUAL( control->active_producers().version, 1u );
produce_block();
BOOST_REQUIRE_EQUAL( control->pending_block_producer(), "alice1111111"_n );
Expand Down Expand Up @@ -901,7 +901,7 @@ BOOST_FIXTURE_TEST_CASE( producer_wtmsig, eosio_system_tester ) try {

produce_block();
produce_block( fc::minutes(2) );
produce_blocks(2);
produce_blocks(config::producer_repetitions * 2);
BOOST_REQUIRE_EQUAL( control->active_producers().version, 2u );
produce_block();
BOOST_REQUIRE_EQUAL( control->pending_block_producer(), "alice1111111"_n );
Expand Down Expand Up @@ -933,7 +933,7 @@ BOOST_FIXTURE_TEST_CASE( producer_wtmsig_transition, eosio_system_tester ) try {

produce_block();
produce_block( fc::minutes(2) );
produce_blocks(2);
produce_blocks(config::producer_repetitions * 2);
BOOST_REQUIRE_EQUAL( control->active_producers().version, 1u );

auto convert_to_block_timestamp = [](const fc::variant& timestamp) -> eosio::chain::block_timestamp_type {
Expand Down Expand Up @@ -2925,6 +2925,10 @@ BOOST_FIXTURE_TEST_CASE(producer_onblock_check, eosio_system_tester) try {
BOOST_REQUIRE_EQUAL(success(), vote( "producvoterb"_n, vector<account_name>(producer_names.begin(), producer_names.begin()+21)));
BOOST_REQUIRE_EQUAL(success(), vote( "producvoterc"_n, vector<account_name>(producer_names.begin(), producer_names.end())));

int retries = 50;
while (produce_block()->producer == config::system_account_name && --retries);
BOOST_REQUIRE(retries > 0);

// give a chance for everyone to produce blocks
{
produce_blocks(21 * 12);
Expand Down

0 comments on commit 229dd4f

Please sign in to comment.