Skip to content

pglite for testing - memory consumption issues? #691

Open
@grmkris

Description

@grmkris

I love idea of using pglite for testing, since i can configure my app to run without any running dependencies. I just init pglite in memory instead of docker pg instance which simplifies my cicd, local run etc etc

buut i'm hitting some issues, my app is pretty large monolith with ~30 test files and each file has ~10 tests..

initally i was naively creating a pglite for each test (beforeEach) but this destroyed my ram... then i moved to a model where i create one pglite, run migration and prepare some inital data and save that as "golden instance" then for each test run i do pglite.clone() to get a clone version..
this still kills my computer in terms of memory, so next optimization would be to use the same pglite for each test inside a test file... but this breaks the logic where each test does not affect the test before or after it...

what are your tips for using pglite in cicd for large test codebases? maybe some examples from the wild ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions