Welcome to mirror list, hosted at ThFree Co, Russian Federation.

init_sql_test.go « nodes « praefect « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2624394006e4c5c380ff775b17424149fbd3b9b7 (plain)
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
29
30
31
32
33
34
// +build postgres

package nodes

import (
	"log"
	"os"
	"testing"

	"gitlab.com/gitlab-org/gitaly/internal/praefect/datastore/glsql"
	"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)

func TestMain(m *testing.M) {
	os.Exit(testMain(m))
}

func testMain(m *testing.M) (code int) {
	defer testhelper.MustHaveNoChildProcess()
	cleanup := testhelper.Configure()
	defer cleanup()

	// Clean closes connection to database once all tests are done
	defer func() {
		if err := glsql.Clean(); err != nil {
			log.Println("database disconnection failure", err)
			code = 1
		}
	}()

	return m.Run()
}

func getDB(t testing.TB) glsql.DB { return glsql.GetDB(t, "nodes") }