Skip to content

Commit

Permalink
Implement runner checkpoint option (#599)
Browse files Browse the repository at this point in the history
* Implement runner checkpoint option

* Add proper address ips on nodeos runner
  • Loading branch information
sparkplug0025 authored Nov 9, 2021
1 parent 0cf518f commit 35247d6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
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

0 comments on commit 35247d6

Please sign in to comment.