# pgtest **Repository Path**: mirrors_rubenv/pgtest ## Basic Information - **Project Name**: pgtest - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # pgtest > Go library to spawn single-use PostgreSQL servers for unit testing [![Build Status](https://github.com/rubenv/pgtest/workflows/Test/badge.svg)](https://github.com/rubenv/pgtest/actions) [![GoDoc](https://godoc.org/github.com/rubenv/pgtest?status.png)](https://godoc.org/github.com/rubenv/pgtest) 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: ```go 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) license.