-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update tests to work locally as well
- Loading branch information
Showing
3 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
import { startHttpRpcServer } from '@aztec/aztec-sandbox'; | ||
import { PXE, createDebugLogger } from '@aztec/aztec.js'; | ||
import { createPXERpcServer } from '@aztec/pxe'; | ||
|
||
import { setup as e2eSetup } from './fixtures/utils.js'; | ||
import { cliTestSuite } from './shared/cli.js'; | ||
|
||
const { PXE_URL } = process.env; | ||
const HTTP_PORT = 9009; | ||
let RPC_URL = `http://localhost:${HTTP_PORT}`; | ||
const debug = createDebugLogger('aztec:e2e_cli'); | ||
|
||
let http: ReturnType<typeof startHttpRpcServer>; | ||
let pxe: PXE; | ||
let teardown: () => Promise<void>; | ||
|
||
// Use Sandbox PXE URL if we're running against sandbox | ||
const { PXE_URL } = process.env; | ||
if (PXE_URL) { | ||
RPC_URL = PXE_URL; | ||
} | ||
|
||
const testSetup = async () => { | ||
const context = await e2eSetup(2); | ||
debug(`Environment set up`); | ||
({ pxe, teardown } = context); | ||
if (!PXE_URL) { | ||
http = startHttpRpcServer(pxe, createPXERpcServer, HTTP_PORT); | ||
debug(`HTTP RPC server started in port ${HTTP_PORT}`); | ||
} | ||
return pxe; | ||
}; | ||
|
||
const testCleanup = async () => { | ||
http?.close(); | ||
await teardown(); | ||
}; | ||
|
||
cliTestSuite('E2E CLI Test', testSetup, testCleanup, createDebugLogger('aztec:e2e_cli'), PXE_URL); | ||
cliTestSuite('E2E CLI Test', testSetup, testCleanup, createDebugLogger('aztec:e2e_cli'), RPC_URL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters