Skip to content

Commit

Permalink
sdk test setup: fix racy access on tmp config file
Browse files Browse the repository at this point in the history
  • Loading branch information
rvantonder committed Jul 12, 2024
1 parent c2548a4 commit 8ca8f33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sdk/typescript/test/e2e/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { execSync } from 'child_process';
import { tmpdir } from 'os';

Check failure on line 5 in sdk/typescript/test/e2e/utils/setup.ts

View workflow job for this annotation

GitHub Actions / Lint, Build, and Test

Insert `mkdtemp·}·from·'fs/promises';⏎import·{·`
import path, { resolve } from 'path';
import tmp from 'tmp';

Check failure on line 7 in sdk/typescript/test/e2e/utils/setup.ts

View workflow job for this annotation

GitHub Actions / Lint, Build, and Test

Delete `';⏎import·{·mkdtemp·}·from·'fs/promises`
import { mkdtemp } from 'fs/promises';
import { retry } from 'ts-retry-promise';
import { expect } from 'vitest';
import { WebSocket } from 'ws';
Expand Down Expand Up @@ -118,7 +119,9 @@ export function getClient(url = DEFAULT_FULLNODE_URL): SuiClient {
export async function setup(options: { graphQLURL?: string; rpcURL?: string } = {}) {
const keypair = Ed25519Keypair.generate();
const address = keypair.getPublicKey().toSuiAddress();
const configPath = path.join(tmpdir(), 'client.yaml');
const tmpDirPath= path.join(tmpdir(), 'config-');

Check failure on line 122 in sdk/typescript/test/e2e/utils/setup.ts

View workflow job for this annotation

GitHub Actions / Lint, Build, and Test

Insert `·`
const tmpDir = await mkdtemp(tmpDirPath);
const configPath = path.join(tmpDir, 'client.yaml');
return setupWithFundedAddress(keypair, address, configPath, options);
}

Expand Down

0 comments on commit 8ca8f33

Please sign in to comment.