From 5fafd88a898bf3dcd2d5bb83090b03592d93e0fd Mon Sep 17 00:00:00 2001 From: MoonBoi9001 Date: Sat, 11 Jul 2026 00:31:00 +1000 Subject: [PATCH] test(common): retry tests that flake on transient RPC drops 4 suites call a live Arbitrum Sepolia RPC endpoint, and its transient connection drops (socket hang up, ECONNRESET) have been failing CI runs on unrelated PRs. Failed tests in those suites now retry up to 2 times, with each error still logged before retrying. --- .../indexer-common/src/allocations/__tests__/tap.test.ts | 4 ++++ .../__tests__/resolvers/cost-models.test.ts | 4 ++++ .../__tests__/resolvers/indexing-rules.test.ts | 6 ++++-- .../__tests__/resolvers/poi-disputes.test.ts | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/indexer-common/src/allocations/__tests__/tap.test.ts b/packages/indexer-common/src/allocations/__tests__/tap.test.ts index 8a748d89a..7f3954a93 100644 --- a/packages/indexer-common/src/allocations/__tests__/tap.test.ts +++ b/packages/indexer-common/src/allocations/__tests__/tap.test.ts @@ -25,6 +25,10 @@ import { hexlify, verifyTypedData } from 'ethers' // eslint-disable-next-line @typescript-eslint/no-explicit-any declare const __DATABASE__: any declare const __LOG_LEVEL__: never + +// This suite reaches a live RPC endpoint, whose transient connection drops (socket hang +// up, ECONNRESET) would otherwise fail CI, so failed tests retry up to 2 times. +jest.retryTimes(2, { logErrorsBeforeRetry: true }) let logger: Logger let tapCollector: TapCollector let metrics: Metrics diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index 734061030..ff1880994 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -18,6 +18,10 @@ import { defineQueryFeeModels } from '../../../query-fees/models' declare const __DATABASE__: any declare const __LOG_LEVEL__: never +// This suite reaches a live RPC endpoint, whose transient connection drops (socket hang +// up, ECONNRESET) would otherwise fail CI, so failed tests retry up to 2 times. +jest.retryTimes(2, { logErrorsBeforeRetry: true }) + const SET_COST_MODEL_MUTATION = gql` mutation setCostModel($costModel: CostModelInput!) { setCostModel(costModel: $costModel) { diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts index b92bf2422..d5afb9953 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts @@ -26,6 +26,10 @@ declare const __DATABASE__: any // eslint-disable-next-line @typescript-eslint/no-explicit-any declare const __LOG_LEVEL__: any +// This suite reaches a live RPC endpoint, whose transient connection drops (socket hang +// up, ECONNRESET) would otherwise fail CI, so failed tests retry up to 2 times. +jest.retryTimes(2, { logErrorsBeforeRetry: true }) + const SET_INDEXING_RULE_MUTATION = gql` mutation setIndexingRule($rule: IndexingRuleInput!) { setIndexingRule(rule: $rule) { @@ -258,7 +262,6 @@ describe('Indexing rules', () => { protocolNetwork: 'eip155:421614', } - // Write the original await expect( client.mutation(SET_INDEXING_RULE_MUTATION, { rule: originalInput }).toPromise(), ).resolves.toHaveProperty('data.setIndexingRule', original) @@ -324,7 +327,6 @@ describe('Indexing rules', () => { protocolNetwork: 'eip155:421614', } - // Write the original await expect( client.mutation(SET_INDEXING_RULE_MUTATION, { rule: originalInput }).toPromise(), ).resolves.toHaveProperty('data.setIndexingRule', original) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts index 4d3405b0d..4a22f609f 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts @@ -21,6 +21,10 @@ declare const __DATABASE__: any // eslint-disable-next-line @typescript-eslint/no-explicit-any declare const __LOG_LEVEL__: any +// This suite reaches a live RPC endpoint, whose transient connection drops (socket hang +// up, ECONNRESET) would otherwise fail CI, so failed tests retry up to 2 times. +jest.retryTimes(2, { logErrorsBeforeRetry: true }) + const STORE_POI_DISPUTES_MUTATION = gql` mutation storeDisputes($disputes: [POIDisputeInput!]!) { storeDisputes(disputes: $disputes) {