This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
bactdb/datastore/db_test.go
2014-09-30 15:13:36 -08:00

26 lines
411 B
Go

package datastore
import (
"log"
"os"
"strings"
)
func init() {
// Make sure we don't run the tests on the main DB (will destroy the data)
dbname := os.Getenv("PGDATABASE")
if dbname == "" {
dbname = "bactdbtest"
}
if !strings.HasSuffix(dbname, "test") {
dbname += "test"
}
if err := os.Setenv("PGDATABASE", dbname); err != nil {
log.Fatal(err)
}
// Reset DB
Connect()
Drop()
Create()
}