diff --git a/src/HavenoClient.test.ts b/src/HavenoClient.test.ts index bf7b4206..1d5c9026 100644 --- a/src/HavenoClient.test.ts +++ b/src/HavenoClient.test.ts @@ -143,11 +143,10 @@ const defaultTradeConfig: Partial = { disputeSummary: "Seller is winner", walletSyncPeriodMs: 5000, maxTimePeerNoticeMs: 5000, - maxConcurrency: 14, // max concurrency - maxConcurrencyCI: 7, // CI test max concurrency stopOnFailure: true, testPayoutConfirmed: true, - testPayoutUnlocked: false + testPayoutUnlocked: false, + maxConcurrency: getMaxConcurrency() } /** @@ -217,8 +216,6 @@ class TradeContext { isPayoutUnlocked?: boolean buyerOpenedDispute?: boolean; sellerOpenedDispute?: boolean; - maxConcurrency?: number; - maxConcurrencyCI?: number; walletSyncPeriodMs: number; maxTimePeerNoticeMs: number; stopOnFailure?: boolean; @@ -230,6 +227,7 @@ class TradeContext { payoutTxId?: string testBalanceChangeEndToEnd?: boolean; isStopped: boolean; + maxConcurrency: number; constructor(ctx?: Partial) { Object.assign(this, ctx); @@ -1647,7 +1645,7 @@ test("Can complete trades at the same time (CI, sanity check)", async () => { } // execute trades with capped concurrency for CI tests - await executeTrades(ctxs, {maxConcurrency: TestConfig.trade.maxConcurrencyCI}); + await executeTrades(ctxs); }); test("Can complete all trade combinations (stress)", async () => { @@ -3874,6 +3872,14 @@ function testMoneroNodeSettingsEqual(settingsBefore: XmrNodeSettings, settingsAf expect(settingsAfter.getStartupFlagsList()).toEqual(settingsBefore.getStartupFlagsList()); } +function getMaxConcurrency() { + return isGitHubActions() ? 4 : 14; +} + +function isGitHubActions() { + return process.env.GITHUB_ACTIONS === 'true'; +} + function getFormField(form: PaymentAccountForm, fieldId: PaymentAccountFormField.FieldId): PaymentAccountFormField { for (const field of form.getFieldsList()) { if (field.getId() == fieldId) return field;