Skip to content

Commit

Permalink
Bump startup time in create-daml-app tests (#11261)
Browse files Browse the repository at this point in the history
We’ve seen this timeout a few times on CI. The version in the compat
tests already has a 60s timeout and that seems to work better so
here’s to hoping this helps.

I’ve also added some logs to see where it stops if it times out
again (jest hides console.log by default which is why this uses
console.debug by default).

changelog_begin
changelog_end
  • Loading branch information
cocreature authored Oct 15, 2021
1 parent 4fac87f commit c8cede0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion templates/create-daml-app-test-resources/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,33 @@ beforeAll(async () => {
`--json-api-option=--port-file=${JSON_API_PORT_FILE_NAME}`,
];

console.debug("Starting daml start");

startProc = spawn('daml', startArgs, startOpts);

await waitOn({resources: [`file:${jsonApiPortFilePath}`]});

console.debug("daml start API are running");

// Run `npm start` in another shell.
// Disable automatically opening a browser using the env var described here:
// https://github.com/facebook/create-react-app/issues/873#issuecomment-266318338
const env = {...process.env, BROWSER: 'none'};
console.debug("Starting npm start");
uiProc = spawn('npm-cli.js', ['run-script', 'start'], { env, stdio: 'inherit', detached: true});
// Note(kill-npm-start): The `detached` flag starts the process in a new process group.
// This allows us to kill the process with all its descendents after the tests finish,
// following https://azimi.me/2014/12/31/kill-child_process-node-js.html.

// Ensure the UI server is ready by checking that the port is available.
await waitOn({resources: [`tcp:localhost:${UI_PORT}`]});
console.debug("npm start is running");

// Launch a single browser for all tests.
console.debug("Starting puppeteer");
browser = await puppeteer.launch();
}, 40_000);
console.debug("Puppeteer is running");
}, 60_000);

afterAll(async () => {
// Kill the `daml start` process, allowing the sandbox and JSON API server to
Expand Down

0 comments on commit c8cede0

Please sign in to comment.