redwood icon indicating copy to clipboard operation
redwood copied to clipboard

E2E Test Directory Cleanup

Open thedavidprice opened this issue 4 years ago • 4 comments

When running the defaul E2E test, a tmp directory is created where a new Redwood project is installed. On my Mac disk, the dir size is ~626mb. I believe Mac OS runs its own cleanup of tmp, however, I’m not very knowledgeable about this process.

Is this a potential issue. If so, should we create a cleanup script or (somehow) handle cleanup in the .tasks/test-tutorial?

thedavidprice avatar Feb 22 '21 20:02 thedavidprice

I like this 👍

peterp avatar Mar 06 '21 15:03 peterp

Suggest this is a separate script that's run at the end of E2E script. In case of canceled run that doesn't complete, could be run standalone. Should have confirmation step.

thedavidprice avatar Mar 09 '21 16:03 thedavidprice

I've also noticed that running e2e leaves the dev server running. The bright side: finally learned how to use the ps command.

jtoar avatar Dec 11 '21 05:12 jtoar

Next steps here: we definitely need to clean up after local e2e. We need a suggestion to the approach. Is it a script that fires at the end? Is it just try catch? Does another process watch the process? Open to suggestions!

jtoar avatar Aug 23 '22 17:08 jtoar

I had a look at run-e2e and one question that comes to mind is when do you consider it to have "ended"?

The e2e script exits before some of the child (or grandchild?) processes created by it have a chance to do what they need to. A way to see this is to delete the tmp folder when e2e exits (simple process.on("exit") hook calling fs.rmSync). If you do that then the dev server fails because the files no longer exist for it.

There would need to be some way to flag that all these asynchronous processes have completed? Taking into account we don't actually expect the dev server to "complete" - we expect the process to run until we kill it ourselves (probably during this cleanup).

Josh-Walker-GM avatar Sep 28 '22 18:09 Josh-Walker-GM