Skip to content

Commit

Permalink
fix for flaky e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes-mysten committed Jan 10, 2025
1 parent ce979bb commit 70d8b6c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
12 changes: 6 additions & 6 deletions packages/deepbook/test/e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ export async function setupSuiClient() {
logger: (msg) => console.warn('Retrying requesting from faucet: ' + msg),
});

const configPath = path.join(
'/test-data',
`${Math.random().toString(36).substring(2, 15)}-client.yaml`,
);
await execSuiTools(['client', '--yes', '--client.config', configPath]);
const configDir = path.join('/test-data', `${Math.random().toString(36).substring(2, 15)}`);
await execSuiTools(['mkdir', '-p', configDir]);
const configPath = path.join(configDir, 'client.yaml');
await execSuiTools(['sui', 'client', '--yes', '--client.config', configPath]);
return new TestToolbox(keypair, client, configPath);
}

Expand All @@ -82,6 +81,7 @@ export async function publishPackage(packageName: string, toolbox?: TestToolbox)
}

const result = await execSuiTools([
'sui',
'move',
'--client.config',
toolbox.configPath,
Expand Down Expand Up @@ -194,7 +194,7 @@ export async function execSuiTools(
const SUI_TOOLS_CONTAINER_ID = inject('suiToolsContainerId');
const container = client.container.getById(SUI_TOOLS_CONTAINER_ID);

const result = await client.container.exec(container, ['sui', ...command], options);
const result = await client.container.exec(container, command, options);

if (result.stderr) {
console.log(result.stderr);
Expand Down
12 changes: 6 additions & 6 deletions packages/kiosk/test/e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ export async function setupSuiClient() {
logger: (msg) => console.warn('Retrying requesting from faucet: ' + msg),
});

const configPath = path.join(
'/test-data',
`${Math.random().toString(36).substring(2, 15)}-client.yaml`,
);
await execSuiTools(['client', '--yes', '--client.config', configPath]);
const configDir = path.join('/test-data', `${Math.random().toString(36).substring(2, 15)}`);
await execSuiTools(['mkdir', '-p', configDir]);
const configPath = path.join(configDir, 'client.yaml');
await execSuiTools(['sui', 'client', '--yes', '--client.config', configPath]);
return new TestToolbox(keypair, client, configPath);
}

Expand All @@ -77,6 +76,7 @@ export async function publishPackage(packageName: string, toolbox?: TestToolbox)
}

const result = await execSuiTools([
'sui',
'move',
'--client.config',
toolbox.configPath,
Expand Down Expand Up @@ -239,7 +239,7 @@ export async function execSuiTools(
const client = await getContainerRuntimeClient();
const container = client.container.getById(SUI_TOOLS_CONTAINER_ID);

const result = await client.container.exec(container, ['sui', ...command], options);
const result = await client.container.exec(container, command, options);

if (result.stderr) {
console.log(result.stderr);
Expand Down
13 changes: 7 additions & 6 deletions packages/typescript/test/e2e/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ export async function setup(options: { graphQLURL?: string; rpcURL?: string } =
const keypair = Ed25519Keypair.generate();
const address = keypair.getPublicKey().toSuiAddress();

const configPath = path.join(
'/test-data',
`${Math.random().toString(36).substring(2, 15)}-client.yaml`,
);
const configDir = path.join('/test-data', `${Math.random().toString(36).substring(2, 15)}`);
await execSuiTools(['mkdir', '-p', configDir]);
const configPath = path.join(configDir, 'client.yaml');
return setupWithFundedAddress(keypair, address, configPath, options);
}

Expand Down Expand Up @@ -159,7 +158,7 @@ export async function setupWithFundedAddress(
},
);

await execSuiTools(['client', '--yes', '--client.config', configPath]);
await execSuiTools(['sui', 'client', '--yes', '--client.config', configPath]);
return new TestToolbox(keypair, rpcURL, configPath);
}

Expand All @@ -170,6 +169,7 @@ export async function publishPackage(packageName: string, toolbox?: TestToolbox)
}

const result = await execSuiTools([
'sui',
'move',
'--client.config',
toolbox.configPath,
Expand Down Expand Up @@ -235,6 +235,7 @@ export async function upgradePackage(
toolbox = await setup();
}
const { stdout } = await execSuiTools([
'sui',
'move',
'--client.config',
toolbox.configPath,
Expand Down Expand Up @@ -362,7 +363,7 @@ export async function execSuiTools(
) {
const container = client.container.getById(SUI_TOOLS_CONTAINER_ID);

const result = await client.container.exec(container, ['sui', ...command], options);
const result = await client.container.exec(container, command, options);

if (result.stderr) {
console.log(result.stderr);
Expand Down

0 comments on commit 70d8b6c

Please sign in to comment.