Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Sep 9, 2023
1 parent 757afa0 commit 51a5413
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions yarn-project/end-to-end/src/cli_docs_sandbox.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AztecAddress, createAztecRpcClient, createDebugLogger, makeFetch, waitForSandbox } from '@aztec/aztec.js';
import { AztecAddress, createDebugLogger, sleep } from '@aztec/aztec.js';
import { getProgram } from '@aztec/cli';
import { TxHash } from '@aztec/types';

Expand All @@ -17,23 +17,26 @@ describe('CLI docs sandbox', () => {
const logs: string[] = [];

beforeAll(async () => {
const aztecRpc = createAztecRpcClient(SANDBOX_URL, makeFetch([1, 2, 3], true));
await waitForSandbox(aztecRpc);

log = (...args: any[]) => {
logs.push(format(...args));
debug(...args);
};

// Requesting block number here with CLI to ensure sandbox is ready
resetCli();
try {
await run('block-number', false);
} catch (e) {
// Failure is expected during first run in CI
}
await waitForSandboxWithCli();
}, 60_000);

const waitForSandboxWithCli = async () => {
while (true) {
resetCli();
try {
await run('get-node-info', false);
break;
} catch (err) {
await sleep(1000);
}
}
};

// in order to run the same command twice, we need to create a new CLI instance
const resetCli = () => {
cli = getProgram(log, debug);
Expand Down Expand Up @@ -78,6 +81,7 @@ describe('CLI docs sandbox', () => {
const docs = `
// docs:start:example-contracts
% aztec-cli example-contracts
CardGameContractAbi
ChildContractAbi
DocsExampleContractAbi
EasyPrivateTokenContractAbi
Expand Down

0 comments on commit 51a5413

Please sign in to comment.