Skip to content

Commit

Permalink
Adding the waitTime and maxAttempts configurable with env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
fmacleal committed Jul 12, 2024
1 parent 791953a commit 2694742
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
INCLUDE_CASES=00_00_01-sync.js,01_01_01-pre_orchid_2wp.js
RUN_EACH_TEST_FILE_THESE_TIMES=1
RUN_ALL_TESTS_THESE_TIMES=1

# Sets the maximum wait time in seconds for a block confirmation before timing out
# This parameter helps in defining how long to wait for a block of within a test to execute before considering the test as failed due to timeout.
# Leave empty to use the default value set within the test framework.
WAIT_TIME_DEFAULT=

# Sets the maximum number of attempts for a test.
# This is used to specify how many times a test should be retried upon failure before being marked as failed.
# Leave empty to use the default value set within the test framework.
MAX_ATTEMPTS_DEFAULT=
4 changes: 3 additions & 1 deletion lib/rsk-utils-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const expect = require('chai').expect;
const btcClientProvider = require('./btc-client-provider');
const { sequentialPromise, wait, interval } = require('./utils');
const { getBridgeAbi, getLatestActiveForkName } = require('./precompiled-abi-forks-util');
const WAIT_TIME_DEFAULT = process.env.WAIT_TIME_DEFAULT || 600
const MAX_ATTEMPTS_DEFAULT = process.env.MAX_ATTEMPTS_DEFAULT || 1000

var getMaxBlockNumber = (rskClients) => {
var maxBlockNumber;
Expand All @@ -26,7 +28,7 @@ var waitForSync = (rskClients) => {
});
};

var waitForBlock = (rskClient, blockNumber, waitTime = 600, maxAttempts = 1000) => {
var waitForBlock = (rskClient, blockNumber, waitTime = WAIT_TIME_DEFAULT, maxAttempts = MAX_ATTEMPTS_DEFAULT) => {
return new Promise((resolve, reject) => {
var clearPoll;
var attempts = 0;
Expand Down

0 comments on commit 2694742

Please sign in to comment.