fergusstrange / embedded-postgres

Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test
MIT License
848 stars 88 forks source link

Why erased RuntimePath directory? #141

Closed pobearm closed 2 months ago

pobearm commented 2 months ago

The RuntimePath directory is erased and recreated at each Start(). In func (ep *EmbeddedPostgres) Start():

if err := os.RemoveAll(ep.config.runtimePath); err != nil {
    return fmt.Errorf("unable to clean up runtime directory %s with error: %s", ep.config.runtimePath, err)

}

Why we earse this directory every time Start? It cause very slow when starting our app. Any ideas of use check instead of erase? Or add some options.

fergusstrange commented 2 months ago

Hey @pobearm this is by design to ensure an absolutely clean instance of Postgres every time. We do this because the tool is intended as a testing tool rather than for persisting data.

What is your use case for context?