Skip to content

Commit

Permalink
Fix merge conflicts, adjust time-outs
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Oct 28, 2021
1 parent fa0e528 commit 0da474e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
2 changes: 1 addition & 1 deletion integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# Runs a specific FFI test
npm test -- --profile ci --name "My wallet FFI test scenario name"
# Runs a complete set of FFI tests
npm test -- --profile ci --tags "@my-wallet-ffi-tag-name"
npm test -- --profile ci --tags "@wallet-ffi"
```

- Runs all @critical tests, but not @long-running
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/features/WalletFFI.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ Feature: Wallet FFI
Scenario: As a client I want to cancel a transaction
Given I have a base node BASE
And I have wallet SENDER connected to base node BASE
And I have a ffi wallet FFI_WALLET connected to base node BASE
And I have mining node MINER connected to base node BASE and wallet SENDER
And mining node MINER mines 10 blocks
Then I wait for wallet SENDER to have at least 1000000 uT
And I have a ffi wallet FFI_WALLET connected to base node BASE
And I send 2000000 uT without waiting for broadcast from wallet SENDER to wallet FFI_WALLET at fee 20
Then ffi wallet FFI_WALLET detects AT_LEAST 1 ffi transactions to be Broadcast
And wallet SENDER detects all transactions are at least Broadcast
Expand Down Expand Up @@ -103,10 +103,10 @@ Feature: Wallet FFI
And I have a base node BASE1 connected to all seed nodes
And I have a base node BASE2 connected to all seed nodes
And I have wallet SENDER connected to base node BASE1
And I have a ffi wallet FFI_WALLET connected to base node BASE1
And I have mining node MINER connected to base node BASE1 and wallet SENDER
And mining node MINER mines 10 blocks
Then I wait for wallet SENDER to have at least 1000000 uT
And I have a ffi wallet FFI_WALLET connected to base node BASE1
And I stop ffi wallet FFI_WALLET
And I send 2000000 uT without waiting for broadcast from wallet SENDER to wallet FFI_WALLET at fee 20
And I restart ffi wallet FFI_WALLET connected to base node BASE2
Expand Down
60 changes: 36 additions & 24 deletions integration_tests/features/support/ffi_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ When(

Then(
"I wait for ffi wallet {word} to have {int} pending outbound transaction(s)",
{ timeout: 40 * 1000 },
{ timeout: 125 * 1000 },
async function (walletName, count) {
let wallet = this.getWallet(walletName);
let broadcast = wallet.getOutboundTransactions();
let length = broadcast.getLength();
broadcast.destroy();
let retries = 1;
const retries_limit = 100;
const retries_limit = 120;
while (length != count && retries <= retries_limit) {
await sleep(1000);
broadcast = wallet.getOutboundTransactions();
Expand Down Expand Up @@ -248,6 +248,7 @@ Then(

Then(
"I wait for ffi wallet {word} to receive {int} transaction",
{ timeout: 125 * 1000 },
async function (walletName, amount) {
let wallet = this.getWallet(walletName);

Expand All @@ -262,7 +263,7 @@ Then(
},
true,
1000,
700
120
);

if (!(wallet.getCounters().received >= amount)) {
Expand All @@ -276,7 +277,7 @@ Then(

Then(
"I wait for ffi wallet {word} to receive {int} finalization",
{ timeout: 126 * 1000 },
{ timeout: 125 * 1000 },
async function (walletName, amount) {
let wallet = this.getWallet(walletName);

Expand All @@ -295,7 +296,7 @@ Then(
},
true,
1000,
700
120
);

if (!(wallet.getCounters().finalized >= amount)) {
Expand All @@ -309,6 +310,7 @@ Then(

Then(
"I wait for ffi wallet {word} to receive {int} broadcast",
{ timeout: 125 * 1000 },
async function (walletName, amount) {
let wallet = this.getWallet(walletName);

Expand All @@ -327,7 +329,7 @@ Then(
},
true,
1000,
700
120
);

if (!(wallet.getCounters().broadcast >= amount)) {
Expand All @@ -341,7 +343,7 @@ Then(

Then(
"I wait for ffi wallet {word} to receive {int} mined",
{ timeout: 7 * 1000 },
{ timeout: 125 * 1000 },
async function (walletName, amount) {
let wallet = this.getWallet(walletName);

Expand All @@ -360,7 +362,7 @@ Then(
},
true,
1000,
700
120
);

if (!(wallet.getCounters().mined >= amount)) {
Expand All @@ -374,6 +376,7 @@ Then(

Then(
"I wait for ffi wallet {word} to receive {word} {int} SAF message",
{ timeout: 125 * 1000 },
async function (walletName, comparison, amount) {
const atLeast = "AT_LEAST";
const exactly = "EXACTLY";
Expand All @@ -395,7 +398,7 @@ Then(
},
true,
1000,
700
120
);

if (!(wallet.getCounters().saf >= amount)) {
Expand All @@ -413,6 +416,7 @@ Then(

Then(
"I wait for ffi wallet {word} to have at least {int} uT",
{ timeout: 125 * 1000 },
async function (walletName, amount) {
let wallet = this.getWallet(walletName);

Expand All @@ -427,7 +431,7 @@ Then(
},
true,
1000,
700
120
);

let balance = wallet.getBalance().available;
Expand All @@ -442,7 +446,7 @@ Then(

Then(
"ffi wallet {word} detects {word} {int} ffi transactions to be Broadcast",
{ timeout: 1200 * 1000 },
{ timeout: 125 * 1000 },
async function (walletName, comparison, amount) {
// Pending -> Completed -> Broadcast -> Mined Unconfirmed -> Mined Confirmed
const atLeast = "AT_LEAST";
Expand All @@ -467,7 +471,7 @@ Then(
},
true,
1000,
700
120
);

if (!(wallet.getCounters().broadcast >= amount)) {
Expand Down Expand Up @@ -542,15 +546,19 @@ Then(
}
);

When("I stop ffi wallet {word}", async function (walletName) {
When("I stop ffi wallet {word}", { timeout: 100 }, function (walletName) {
let wallet = this.getWallet(walletName);
await wallet.stop();
wallet.resetCounters();
});
When(
"I stop ffi wallet {word}",
{ timeout: 20 * 1000 },
async function (walletName) {
let wallet = this.getWallet(walletName);
await wallet.stop();
wallet.resetCounters();
}
);

Then(
"I start TXO validation on ffi wallet {word}",
{ timeout: 125 * 1000 },
async function (walletName) {
const wallet = this.getWallet(walletName);
await wallet.startTxoValidation();
Expand All @@ -560,10 +568,14 @@ Then(
}
);

Then("I start TX validation on ffi wallet {word}", async function (walletName) {
const wallet = this.getWallet(walletName);
await wallet.startTxValidation();
while (!wallet.getTxValidationStatus().tx_validation_complete) {
await sleep(1000);
Then(
"I start TX validation on ffi wallet {word}",
{ timeout: 125 * 1000 },
async function (walletName) {
const wallet = this.getWallet(walletName);
await wallet.startTxValidation();
while (!wallet.getTxValidationStatus().tx_validation_complete) {
await sleep(1000);
}
}
});
);

0 comments on commit 0da474e

Please sign in to comment.