mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
deps: upgrade github.com/sourcegraph/log (#41058)
This upgrade includes sourcegraph/log@4bb9844, correctly re-introducing the intended behaviour of panicking if a pre-package-init-logger-initialization is detected in dev environments. It also includes a fix for a library initialization race condition.
This commit is contained in:
parent
41ae3051d9
commit
0d61e0dfcd
@ -16,6 +16,8 @@ import (
|
||||
|
||||
gqlerrors "github.com/graph-gophers/graphql-go/errors"
|
||||
"github.com/inconshreveable/log15"
|
||||
sglog "github.com/sourcegraph/log"
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
@ -25,10 +27,20 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/rcache"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if !testing.Verbose() {
|
||||
log15.Root().SetHandler(log15.DiscardHandler())
|
||||
log.SetOutput(io.Discard)
|
||||
logtest.InitWithLevel(m, sglog.LevelNone)
|
||||
} else {
|
||||
logtest.Init(m)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func BenchmarkPrometheusFieldName(b *testing.B) {
|
||||
tests := [][3]string{
|
||||
{"Query", "settingsSubject", "settingsSubject"},
|
||||
@ -129,15 +141,6 @@ func TestResolverTo(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if !testing.Verbose() {
|
||||
log15.Root().SetHandler(log15.DiscardHandler())
|
||||
log.SetOutput(io.Discard)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestAffiliatedRepositories(t *testing.T) {
|
||||
resetMocks()
|
||||
rcache.SetupForTest(t)
|
||||
|
||||
@ -1580,6 +1580,8 @@ func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if !testing.Verbose() {
|
||||
logtest.InitWithLevel(m, log.LevelNone)
|
||||
} else {
|
||||
logtest.Init(m)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@ -75,10 +75,10 @@ func Start(logger log.Logger, registerEnterpriseMigrators registerMigratorsUsing
|
||||
cliutil.Validate(appName, newRunner, outputFactory),
|
||||
cliutil.Describe(appName, newRunner, outputFactory),
|
||||
cliutil.Drift(appName, newRunner, outputFactory, cliutil.GCSExpectedSchemaFactory, cliutil.GitHubExpectedSchemaFactory),
|
||||
cliutil.AddLog(logger, appName, newRunner, outputFactory),
|
||||
cliutil.Upgrade(logger, appName, newRunnerWithSchemas, outputFactory, registerMigrators),
|
||||
cliutil.Downgrade(logger, appName, newRunnerWithSchemas, outputFactory, registerMigrators),
|
||||
cliutil.RunOutOfBandMigrations(logger, appName, newRunner, outputFactory, registerMigrators),
|
||||
cliutil.AddLog(appName, newRunner, outputFactory),
|
||||
cliutil.Upgrade(appName, newRunnerWithSchemas, outputFactory, registerMigrators),
|
||||
cliutil.Downgrade(appName, newRunnerWithSchemas, outputFactory, registerMigrators),
|
||||
cliutil.RunOutOfBandMigrations(appName, newRunner, outputFactory, registerMigrators),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -84,8 +84,6 @@ var (
|
||||
Required: true,
|
||||
Destination: &targetRevision,
|
||||
}
|
||||
|
||||
logger = log.Scoped("sg migration", "")
|
||||
)
|
||||
|
||||
var (
|
||||
@ -117,7 +115,7 @@ var (
|
||||
validateCommand = cliutil.Validate("sg migration", makeRunner, outputFactory)
|
||||
describeCommand = cliutil.Describe("sg migration", makeRunner, outputFactory)
|
||||
driftCommand = cliutil.Drift("sg migration", makeRunner, outputFactory, cliutil.GCSExpectedSchemaFactory, localGitExpectedSchemaFactory)
|
||||
addLogCommand = cliutil.AddLog(logger, "sg migration", makeRunner, outputFactory)
|
||||
addLogCommand = cliutil.AddLog("sg migration", makeRunner, outputFactory)
|
||||
|
||||
leavesCommand = &cli.Command{
|
||||
Name: "leaves",
|
||||
|
||||
13
enterprise/cmd/worker/internal/permissions/main_test.go
Normal file
13
enterprise/cmd/worker/internal/permissions/main_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package permissions
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
@ -3,6 +3,7 @@ package syncer
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -24,6 +25,11 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func newTestStore() *MockSyncStore {
|
||||
s := NewMockSyncStore()
|
||||
s.ClockFunc.SetDefaultReturn(timeutil.Now)
|
||||
|
||||
13
enterprise/internal/database/main_test.go
Normal file
13
enterprise/internal/database/main_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package queryrunner
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
13
enterprise/internal/notebooks/main_test.go
Normal file
13
enterprise/internal/notebooks/main_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package notebooks
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
2
go.mod
2
go.mod
@ -140,7 +140,7 @@ require (
|
||||
github.com/sourcegraph/go-lsp v0.0.0-20200429204803-219e11d77f5d
|
||||
github.com/sourcegraph/go-rendezvous v0.0.0-20210910070954-ef39ade5591d
|
||||
github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf
|
||||
github.com/sourcegraph/log v0.0.0-20220829165858-090861ec23a3
|
||||
github.com/sourcegraph/log v0.0.0-20220901143117-fc0516a694c9
|
||||
github.com/sourcegraph/run v0.9.0
|
||||
github.com/sourcegraph/scip v0.1.0
|
||||
github.com/sourcegraph/sourcegraph/enterprise/dev/ci/images v0.0.0-20220203145655-4d2a39d3038a
|
||||
|
||||
4
go.sum
4
go.sum
@ -2066,8 +2066,8 @@ github.com/sourcegraph/httpgzip v0.0.0-20211015085752-0bad89b3b4df h1:VaS8k40GiN
|
||||
github.com/sourcegraph/httpgzip v0.0.0-20211015085752-0bad89b3b4df/go.mod h1:RqWagzxNGCvucQQC9vX6aps474LCCOgshDpUTTyb+O8=
|
||||
github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf h1:oAdWFqhStsWiiMP/vkkHiMXqFXzl1XfUNOdxKJbd6bI=
|
||||
github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf/go.mod h1:ppFaPm6kpcHnZGqQTFhUIAQRIEhdQDWP1PCv4/ON354=
|
||||
github.com/sourcegraph/log v0.0.0-20220829165858-090861ec23a3 h1:dVvsmHcSeGtv/BcQVeEzS3oBcoz2qYtsKYKEHpV6IjE=
|
||||
github.com/sourcegraph/log v0.0.0-20220829165858-090861ec23a3/go.mod h1:UxiwB6C3xk3xOySJpW1R0MDUyfGuJRFS5Z8C+SA5p2I=
|
||||
github.com/sourcegraph/log v0.0.0-20220901143117-fc0516a694c9 h1:JjFyvx9hCD5+JpuRV6t+gTQgGFvwkxXMZzOc4sLiPqc=
|
||||
github.com/sourcegraph/log v0.0.0-20220901143117-fc0516a694c9/go.mod h1:UxiwB6C3xk3xOySJpW1R0MDUyfGuJRFS5Z8C+SA5p2I=
|
||||
github.com/sourcegraph/oauth2 v0.0.0-20210825125341-77c1d99ece3c h1:HGa4iJr6MGKnB5qbU7tI511NdGuHUHnNCqP67G6KmfE=
|
||||
github.com/sourcegraph/oauth2 v0.0.0-20210825125341-77c1d99ece3c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
github.com/sourcegraph/otelsql v0.0.0-20220825134523-e3712953a6a5 h1:gv92/ctwOCyj13tV94TX/FYXrHNdZMmGYc46AdLnmzM=
|
||||
|
||||
@ -13,6 +13,8 @@ func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if !testing.Verbose() {
|
||||
logtest.InitWithLevel(m, log.LevelNone)
|
||||
} else {
|
||||
logtest.Init(m)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/lib/output"
|
||||
)
|
||||
|
||||
func AddLog(logger log.Logger, commandName string, factory RunnerFactory, outFactory OutputFactory) *cli.Command {
|
||||
func AddLog(commandName string, factory RunnerFactory, outFactory OutputFactory) *cli.Command {
|
||||
schemaNameFlag := &cli.StringFlag{
|
||||
Name: "db",
|
||||
Usage: "The target `schema` to modify.",
|
||||
@ -34,6 +34,7 @@ func AddLog(logger log.Logger, commandName string, factory RunnerFactory, outFac
|
||||
schemaName = schemaNameFlag.Get(cmd)
|
||||
versionFlag = versionFlag.Get(cmd)
|
||||
upFlag = upFlag.Get(cmd)
|
||||
logger = log.Scoped("up", "migration up command")
|
||||
)
|
||||
|
||||
_, store, err := setupStore(ctx, factory, schemaName)
|
||||
|
||||
@ -3,7 +3,6 @@ package cliutil
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/oobmigration"
|
||||
@ -13,7 +12,6 @@ import (
|
||||
)
|
||||
|
||||
func Downgrade(
|
||||
logger log.Logger,
|
||||
commandName string,
|
||||
runnerFactory RunnerFactoryWithSchemas,
|
||||
outFactory OutputFactory,
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
@ -20,7 +19,6 @@ import (
|
||||
)
|
||||
|
||||
func RunOutOfBandMigrations(
|
||||
logger log.Logger,
|
||||
commandName string,
|
||||
runnerFactory RunnerFactory,
|
||||
outFactory OutputFactory,
|
||||
|
||||
@ -3,7 +3,6 @@ package cliutil
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/oobmigration"
|
||||
@ -13,7 +12,6 @@ import (
|
||||
)
|
||||
|
||||
func Upgrade(
|
||||
logger log.Logger,
|
||||
commandName string,
|
||||
runnerFactory RunnerFactoryWithSchemas,
|
||||
outFactory OutputFactory,
|
||||
|
||||
@ -22,6 +22,11 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
// Notable versions:
|
||||
//
|
||||
// v3.29.0 -> oldest supported
|
||||
|
||||
@ -2,6 +2,7 @@ package insights
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
@ -19,6 +20,11 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestGetSearchInsights(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
13
internal/oobmigration/main_test.go
Normal file
13
internal/oobmigration/main_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package oobmigration
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logtest.Init(m)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
@ -6,12 +6,17 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/sourcegraph/log"
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if !testing.Verbose() {
|
||||
logtest.InitWithLevel(m, log.LevelNone)
|
||||
log15.Root().SetHandler(log15.DiscardHandler())
|
||||
} else {
|
||||
logtest.Init(m)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user