Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk test setup: fix racy access on tmp config file #18628

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { execSync } from 'child_process';
import { mkdtemp } from 'fs/promises';
import { tmpdir } from 'os';
import path, { resolve } from 'path';
import tmp from 'tmp';
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-');
const tmpDir = await mkdtemp(tmpDirPath);
const configPath = path.join(tmpDir, 'client.yaml');
return setupWithFundedAddress(keypair, address, configPath, options);
}

Expand Down
Loading