Skip to content

Commit

Permalink
reduce trade concurrency to 4 in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Apr 8, 2024
1 parent b304139 commit 28a47e1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/HavenoClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,10 @@ const defaultTradeConfig: Partial<TradeContext> = {
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()
}

/**
Expand Down Expand Up @@ -217,8 +216,6 @@ class TradeContext {
isPayoutUnlocked?: boolean
buyerOpenedDispute?: boolean;
sellerOpenedDispute?: boolean;
maxConcurrency?: number;
maxConcurrencyCI?: number;
walletSyncPeriodMs: number;
maxTimePeerNoticeMs: number;
stopOnFailure?: boolean;
Expand All @@ -230,6 +227,7 @@ class TradeContext {
payoutTxId?: string
testBalanceChangeEndToEnd?: boolean;
isStopped: boolean;
maxConcurrency: number;

constructor(ctx?: Partial<TradeContext>) {
Object.assign(this, ctx);
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 28a47e1

Please sign in to comment.