Skip to content

Commit

Permalink
Merge pull request NomicFoundation#1106 from nomiclabs/ci-false-negat…
Browse files Browse the repository at this point in the history
…ives

Reduce CI false negatives
  • Loading branch information
alcuadrado committed Dec 28, 2020
2 parents 857d715 + 79cda05 commit 547c750
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
steps:
- uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12
- uses: actions/checkout@v2
- name: Install
run: yarn --frozen-lockfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,16 @@ export class JsonRpcClient {
}

private _shouldRetry(isRetryCall: boolean, err: any) {
const isRetriableError =
err.message.includes("header not found") ||
err.message.includes("connect ETIMEDOUT");

const isServiceUrl =
this._httpProvider.url.includes("infura") ||
this._httpProvider.url.includes("alchemyapi");

return (
!isRetryCall &&
this._httpProvider.url.includes("infura") &&
err instanceof Error &&
err.message.includes("header not found")
!isRetryCall && isServiceUrl && err instanceof Error && isRetriableError
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ const PRECOMPILES_COUNT = 8;

describe("Eth module", function () {
PROVIDERS.forEach(({ name, useProvider, isFork, chainId }) => {
if (isFork) {
this.timeout(50000);
}

describe(`${name} provider`, function () {
setCWD();
useProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ async function deployContract(
}

describe("Evm module", function () {
PROVIDERS.forEach(({ name, useProvider }) => {
PROVIDERS.forEach(({ name, useProvider, isFork }) => {
if (isFork) {
this.timeout(50000);
}

describe(`${name} provider`, function () {
setCWD();
useProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { PROVIDERS } from "../../helpers/providers";

describe("Hardhat module", function () {
PROVIDERS.forEach(({ name, useProvider, isFork }) => {
if (isFork) {
this.timeout(50000);
}

describe(`${name} provider`, function () {
setCWD();
useProvider();
Expand Down Expand Up @@ -149,7 +153,7 @@ describe("Hardhat module", function () {

// This condition is rather loose as Infura can sometimes return
// a smaller block number on subsequent eth_blockNumber call
assert.closeTo(await getLatestBlockNumber(), initialBlock, 2);
assert.closeTo(await getLatestBlockNumber(), initialBlock, 4);
});

it("can reset the forked provider to a normal provider", async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { setCWD } from "../../helpers/cwd";
import { PROVIDERS } from "../../helpers/providers";

describe("Net module", function () {
PROVIDERS.forEach(({ name, useProvider, networkId }) => {
PROVIDERS.forEach(({ name, useProvider, networkId, isFork }) => {
if (isFork) {
this.timeout(50000);
}

describe(`Provider ${name}`, function () {
setCWD();
useProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { setCWD } from "../../helpers/cwd";
import { PROVIDERS } from "../../helpers/providers";

describe("Web3 module", function () {
PROVIDERS.forEach(({ name, useProvider }) => {
PROVIDERS.forEach(({ name, useProvider, isFork }) => {
if (isFork) {
this.timeout(50000);
}

describe(`Provider ${name}`, function () {
setCWD();
useProvider();
Expand Down

0 comments on commit 547c750

Please sign in to comment.