stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

Speed up `CI / test (api)` step

Open zone117x opened this issue 1 year ago • 1 comments

This CI step takes 10+ minutes now. It's slow because all the tests run in-band (serial rather than in parallel) so that they don't clobber each other's postgres db.

The tests could be made to ran in parallel by having them use their own temporary postgres schema (a container/namespace within a database).

One approach is to create a jest setupFilesAfterEnv script that configures PG_SCHEMA:

process.env.PG_SCHEMA = crypto.randomUUID();

zone117x avatar Oct 23 '24 10:10 zone117x

Is it worth exploring something like https://pglite.dev/ ? It basically allows very light-weight in-memory postgres instances for CI.

diwakergupta avatar Oct 23 '24 14:10 diwakergupta