Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement runner checkpoint option #599

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
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
30 changes: 29 additions & 1 deletion contracts/eden/tests/include/nodeos-runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,39 @@

#include <tester-base.hpp>

#define CATCH_CONFIG_RUNNER

std::string runner_checkpoint;

int main(int argc, char* argv[])
{
Catch::Session session;
auto cli =
session.cli() | Catch::clara::Opt(runner_checkpoint, "checkpoint")["-c"]["--checkpoint"](
"Stops execution at the given checkpoint label.");
session.cli(cli);
auto ret = session.applyCommandLine(argc, argv);
if (ret)
return ret;
return session.run();
}

struct nodeos_runner
{
eden_tester tester;
std::string runner_name;

nodeos_runner(std::string runner_name) : runner_name(runner_name) {}

void checkpoint(const std::string& checkpoint)
{
if (runner_checkpoint == checkpoint)
{
start_nodeos();
exit(0);
}
}

void start_nodeos()
{
// tolerance blocks
Expand All @@ -32,6 +58,8 @@ struct nodeos_runner
"--access-control-allow-origin \"*\" " //
"--access-control-allow-header \"*\" " //
"--http-validate-host 0 " //
"--http-server-address 0.0.0.0:8888 " //
"--state-history-endpoint 0.0.0.0:8080 " //
"-e -p eosio");
}
};
};
4 changes: 2 additions & 2 deletions contracts/eden/tests/run-full-election.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define CATCH_CONFIG_MAIN

#include <nodeos-runner.hpp>

TEST_CASE("Setup Eden chain with full election")
Expand All @@ -8,7 +6,9 @@ TEST_CASE("Setup Eden chain with full election")

r.tester.genesis();
r.tester.run_election(true, 10000, true);
r.checkpoint("small_election");
r.tester.induct_n(100);
r.checkpoint("inductions");
r.tester.run_election(true, 10000, true);

r.start_nodeos();
Expand Down
2 changes: 0 additions & 2 deletions contracts/eden/tests/run-genesis.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define CATCH_CONFIG_MAIN

#include <nodeos-runner.hpp>

TEST_CASE("Setup Eden chain with basic completed genesis")
Expand Down