Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rubenv/pgtest

Repository files navigation

pgtest

Go library to spawn single-use PostgreSQL servers for unit testing

Build Status GoDoc

Spawns a PostgreSQL server with a single database configured. Ideal for unit tests where you want a clean instance each time. Then clean up afterwards.

Features:

  • Starts a clean isolated PostgreSQL database
  • Tested on Fedora, Ubuntu and Alpine
  • Optimized for in-memory execution, to speed up unit tests
  • Less than 1 second startup / initialization time
  • Automatically drops permissions when testing as root

Usage

In your unit test:

pg, err := pgtest.Start()
defer pg.Stop()
// Do something with pg.DB (which is a *sql.DB)

License

This library is distributed under the MIT license.

About

PostgreSQL test helper for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

Languages

AltStyle によって変換されたページ (->オリジナル) /