mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
init and ping testdb
This commit is contained in:
parent
208c5daf9f
commit
8872541c2a
@ -23,5 +23,8 @@ go_test(
|
||||
srcs = ["util_test.go"],
|
||||
embed = [":upgrades"],
|
||||
tags = ["requires-network"],
|
||||
deps = ["//internal/observation"],
|
||||
deps = [
|
||||
"//internal/database/dbtest",
|
||||
"//internal/observation",
|
||||
],
|
||||
)
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbtest"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
)
|
||||
|
||||
@ -95,8 +96,22 @@ func TestCheckConnection_Ping(t *testing.T) {
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
db := dbtest.NewDB(t)
|
||||
defer db.Close()
|
||||
|
||||
var dbName string
|
||||
err := db.QueryRow("SELECT current_database()").Scan(&dbName)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
t.Setenv("CODEINTEL_PG_ALLOW_SINGLE_DB", "true")
|
||||
t.Setenv("PGUSER", "sourcegraph")
|
||||
t.Setenv("PGPASSWORD", "sourcegraph")
|
||||
t.Setenv("PGDATABASE", dbName)
|
||||
t.Setenv("PGSSLMODE", "disable")
|
||||
t.Setenv("PGTZ", "UTC")
|
||||
|
||||
dsns, err := getApplianceDSNs()
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user