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

init_test.go « datastore « praefect « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: da3f53344b47c6f8071bc71cc2545991f9c546b1 (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
// +build postgres

package datastore

import (
	"log"
	"os"
	"testing"

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

func TestMain(m *testing.M) {
	code := m.Run()
	// Clean closes connection to database once all tests are done
	if err := glsql.Clean(); err != nil {
		log.Fatalln(err, "database disconnection failure")
	}
	os.Exit(code)
}

const databaseName = "datastore"

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

func getDBConfig(t testing.TB) config.DB { return glsql.GetDBConfig(t, databaseName) }