base_test.go 357 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
package tests

import (
	"fmt"
	"os"
	"testing"

	"dfss/mgdb"
)

func TestMain(m *testing.M) {

	dbURI = os.Getenv("DFSS_MONGO_URI")
	if dbURI == "" {
		dbURI = "mongodb://localhost/dfss-test"
	}

	var err error
	dbManager, err = mgdb.NewManager(dbURI)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	code := m.Run()
	eraseDatabase()
	os.Exit(code)
}