Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Develop: add a second account to exhausive_snapshot_test #9987

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions unittests/snapshot_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,29 @@ void exhaustive_snapshot(const eosio::chain::backing_store_type main_store,
fc::temp_directory temp_dir;
tester chain(temp_dir, [main_store] (auto& config) { config.backing_store = main_store; }, true);

chain.create_account("snapshot"_n);
// create 2 accounts to exercise more paths
chain.create_accounts({"snapshot"_n, "snapshot1"_n});

// set code for the first account
chain.produce_blocks(1);
chain.set_code("snapshot"_n, contracts::snapshot_test_wasm());
chain.set_abi("snapshot"_n, contracts::snapshot_test_abi().data());
chain.produce_blocks(1);

// increment the test contract
chain.push_action("snapshot"_n, "increment"_n, "snapshot"_n, mutable_variant_object()
( "value", 1 )
);

// set code for the second account
chain.produce_blocks(1);
chain.set_code("snapshot1"_n, contracts::snapshot_test_wasm());
chain.set_abi("snapshot1"_n, contracts::snapshot_test_abi().data());
chain.produce_blocks(1);
// increment the test contract
chain.push_action("snapshot1"_n, "increment"_n, "snapshot1"_n, mutable_variant_object()
( "value", 1 )
);

chain.produce_blocks(1);

chain.control->abort_block();
Expand All @@ -212,10 +224,13 @@ void exhaustive_snapshot(const eosio::chain::backing_store_type main_store,
new_config.backing_store = sub_store;
sub_testers.emplace_back(new_config, SnapshotSuite::get_reader(snapshot), generation);

// increment the test contract
// increment the test contracts
chain.push_action("snapshot"_n, "increment"_n, "snapshot"_n, mutable_variant_object()
( "value", 1 )
);
chain.push_action("snapshot1"_n, "increment"_n, "snapshot1"_n, mutable_variant_object()
( "value", 1 )
);

// produce block
auto new_block = chain.produce_block();
Expand Down