Skip to content

Commit

Permalink
Merge pull request #318 from onflow/ci-e2e-test-improvements
Browse files Browse the repository at this point in the history
CI improvements for E2E tests
  • Loading branch information
devbugging authored Jun 25, 2024
2 parents 5ca04ed + 1449365 commit 9834634
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ e2e-test:
# test all packages
go clean -testcache
cd tests/web3js && npm install
cd tests && go test -cover ./...
cd tests && LOG_OUTPUT=false go test -cover ./...

.PHONY: check-tidy
check-tidy:
Expand Down
11 changes: 4 additions & 7 deletions tests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,13 @@ func servicesSetup(t *testing.T) (emulator.Emulator, func()) {
// executeTest will run the provided JS test file using mocha
// and will report failure or success of the test.
func executeTest(t *testing.T, testFile string) {
command := fmt.Sprintf("./web3js/node_modules/.bin/mocha ./web3js/%s.js", testFile)
command := fmt.Sprintf(
"./web3js/node_modules/.bin/mocha ./web3js/%s.js --timeout 120s --retries 3",
testFile,
)
parts := strings.Fields(command)

t.Run(testFile, func(t *testing.T) {
// timeout for tests
go func() {
time.Sleep(time.Minute * 2)
t.FailNow()
}()

cmd := exec.Command(parts[0], parts[1:]...)
if cmd.Err != nil {
panic(cmd.Err)
Expand Down
2 changes: 1 addition & 1 deletion tests/web3js/eth_deploy_contract_and_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ it('deploy contract and interact', async() => {
)
}

}).timeout(10*1000)
})
2 changes: 1 addition & 1 deletion tests/web3js/eth_get_filter_logs_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ it('create logs filter and call eth_getFilterLogs', async () => {
web3.eth.abi.decodeParameter("int256", logs[1].data)
)

}).timeout(10 * 1000)
})
2 changes: 1 addition & 1 deletion tests/web3js/eth_get_transaction_by_hash_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ it('returns proper response for eth_getTransactionByHash', async () => {
assert.equal(tx.maxFeePerGas, 3000000000n)
assert.equal(tx.maxPriorityFeePerGas, 800000000n)
assert.equal(tx.gasPrice, 3000000000n)
}).timeout(10 * 1000)
})
2 changes: 1 addition & 1 deletion tests/web3js/eth_logs_filtering_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ it('emit logs and retrieve them using different filters', async() => {
// todo compose more complex topic filters using OR and AND logic
*/

}).timeout(20*1000)
})
2 changes: 1 addition & 1 deletion tests/web3js/eth_streaming_filters_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ it('streaming of logs using filters', async() => {
await assertFilterLogs(await rawSubscribe({ address: contractAddress, fromBlock: "0x0" }), testValues)

process.exit(0)
}).timeout(timeout*1000)
})
2 changes: 1 addition & 1 deletion tests/web3js/eth_streaming_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ it('streaming of blocks, transactions, logs using filters', async () => {
assert.deepEqual(logTxHashes, sentHashes)

process.exit(0)
}).timeout(timeout * 1500)
})
2 changes: 1 addition & 1 deletion tests/web3js/eth_transfer_between_eoa_accounts_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ it('transfer flow between two EOA accounts', async () => {
// get balance at latest block number
receiverWei = await web3.eth.getBalance(receiver.address, latest)
assert.equal(receiverWei, transferValue)
}).timeout(10 * 1000)
})
2 changes: 1 addition & 1 deletion tests/web3js/setup_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ const conf = require('./config')
it('checks test setup', async() => {
assert.equal(1, 1) // always true
assert.isNotEmpty(conf.web3)
}).timeout(10*1000)
})

0 comments on commit 9834634

Please sign in to comment.