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

test: Add rebuild-db integration test #3232

Merged
merged 2 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 7 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,19 @@ commands:
name: Check eslint
command: cd integration_tests && npm run lint
- run:
name: Pre-build base node
name: Build base node
command: cargo build --release --bin tari_base_node
- run:
name: Pre-build wallet
name: Build wallet
command: cargo build --release --bin tari_console_wallet
- run:
name: Pre-build mmproxy
name: Build wallet FFI
command: cargo build --release --package tari_wallet_ffi
- run:
name: Build mmproxy
command: cargo build --release --bin tari_merge_mining_proxy
- run:
name: Pre-build mining_node
name: Build mining_node
command: cargo build --release --bin tari_mining_node
- run:
name: Run cucumber scenarios
Expand Down
17 changes: 17 additions & 0 deletions integration_tests/features/Recovery.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@recovery
Feature: Recovery

Scenario Outline: Blockchain database recovery
Given I have 2 seed nodes
And I have a base node B connected to all seed nodes
When I mine <NumBlocks> blocks on B
Then all nodes are at height <NumBlocks>
When I stop node B
And I run blockchain recovery on node B
And I start base node B
Then all nodes are at height <NumBlocks>
Examples:
| NumBlocks |
| 10 |
| 25 |
| 50 |
8 changes: 8 additions & 0 deletions integration_tests/features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,14 @@ When(/I start base node (.*)/, { timeout: 20 * 1000 }, async function (name) {
await this.startNode(name);
});

When(
/I run blockchain recovery on node (\S*)/,
{ timeout: 120 * 1000 },
async function (name) {
await this.startNode(name, ["--rebuild-db"]);
}
);

When(/I stop node (.*)/, async function (name) {
await this.stopNode(name);
});
Expand Down
5 changes: 3 additions & 2 deletions integration_tests/features/support/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ class CustomWorld {
await node.stop();
}

async startNode(name) {
async startNode(name, args) {
const node = this.seeds[name] || this.nodes[name];
await node.start();
await node.start(args);
}

addTransaction(pubKey, txId) {
Expand Down Expand Up @@ -338,6 +338,7 @@ BeforeAll({ timeout: 1200000 }, async function () {
await miningNode.init(1, 1, 1, 1, true, 1);
await miningNode.compile();

console.log("Compiling wallet FFI...");
await WalletFFIClient.Init();
console.log("Finished compilation.");
});
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/helpers/baseNodeProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ class BaseNodeProcess {
return await this.createGrpcClient();
}

async start() {
async start(opts = []) {
const args = ["--base-path", "."];
if (this.logFilePath) {
args.push("--log-config", this.logFilePath);
}
args.push(...opts);
return await this.run(await this.compile(), args);
}

Expand Down