Skip to content

Commit

Permalink
Merge pull request #1832 from AntelopeIO/increase_max_transaction_tim…
Browse files Browse the repository at this point in the history
…e_readony_tests_main

[5.0 -> main] Increase max-transaction-time for read_only_trx unit tests
  • Loading branch information
linh2931 authored Oct 26, 2023
2 parents 9fe0a72 + f523537 commit 452f3ea
Showing 1 changed file with 17 additions and 31 deletions.
48 changes: 17 additions & 31 deletions tests/test_read_only_trx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,16 @@ void test_trxs_common(std::vector<const char*>& specific_args, bool test_disable
std::thread app_thread( [&]() {
try {
fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::debug);
std::vector<const char*> argv = {"test", "--data-dir", temp_dir_str.c_str(), "--config-dir", temp_dir_str.c_str()};
std::vector<const char*> argv = {
"test", // dummy executible name
"-p", "eosio", "-e", // actual arguments follow
"--data-dir", temp_dir_str.c_str(),
"--config-dir", temp_dir_str.c_str(),
"--max-transaction-time=100",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=400000"
};
argv.insert(argv.end(), specific_args.begin(), specific_args.end());
app->initialize<chain_plugin, producer_plugin>(argv.size(), (char**)&argv[0]);
app->find_plugin<chain_plugin>()->chain();
Expand Down Expand Up @@ -179,62 +188,39 @@ void test_trxs_common(std::vector<const char*>& specific_args, bool test_disable

// test read-only trxs on 1 threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_1_read_only_threads) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=1",
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=40000" };
std::vector<const char*> specific_args = { "--read-only-threads=1" };
test_trxs_common(specific_args);
}

// test read-only trxs on 3 threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_3_read_only_threads) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=3",
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=40000" };
std::vector<const char*> specific_args = { "--read-only-threads=3" };
test_trxs_common(specific_args);
}

// test read-only trxs on 3 threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_3_read_only_threads_no_tierup) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=3",
std::vector<const char*> specific_args = { "--read-only-threads=3",
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
"--eos-vm-oc-enable=none",
#endif
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=40000" };
};
test_trxs_common(specific_args, true);
}

// test read-only trxs on 8 separate threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_8_read_only_threads) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=8",
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=10000",
"--read-only-read-window-time-us=400000" };
std::vector<const char*> specific_args = { "--read-only-threads=8" };
test_trxs_common(specific_args);
}

// test read-only trxs on 8 separate threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_8_read_only_threads_no_tierup) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=8",
std::vector<const char*> specific_args = { "--read-only-threads=8",
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
"--eos-vm-oc-enable=none",
#endif
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=10000",
"--read-only-read-window-time-us=400000" };
};
test_trxs_common(specific_args, true);
}

Expand Down

0 comments on commit 452f3ea

Please sign in to comment.