Chore: Make test tracer noop and return no errors (#50797)
This commit is contained in:
@@ -22,8 +22,7 @@ func TestIntegrationEngineTimeouts(t *testing.T) {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
usMock := &usagestats.UsageStatsMock{T: t}
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
engine := ProvideAlertEngine(nil, nil, nil, usMock, ossencryption.ProvideService(), nil, tracer, nil, setting.NewCfg(), nil, nil)
|
||||
setting.AlertingNotificationTimeout = 30 * time.Second
|
||||
setting.AlertingMaxAttempts = 3
|
||||
|
||||
@@ -100,8 +100,7 @@ func (a *AlertStoreMock) SetAlertState(_ context.Context, _ *models.SetAlertStat
|
||||
|
||||
func TestEngineProcessJob(t *testing.T) {
|
||||
usMock := &usagestats.UsageStatsMock{T: t}
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
|
||||
store := &AlertStoreMock{}
|
||||
engine := ProvideAlertEngine(nil, nil, nil, usMock, ossencryption.ProvideService(), nil, tracer, store, setting.NewCfg(), nil, nil)
|
||||
|
||||
@@ -79,8 +79,7 @@ func getContextHandler(t *testing.T) *ContextHandler {
|
||||
userAuthTokenSvc := auth.NewFakeUserAuthTokenService()
|
||||
renderSvc := &fakeRenderService{}
|
||||
authJWTSvc := models.NewFakeJWTService()
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
|
||||
loginService := loginservice.LoginServiceMock{ExpectedUser: &models.User{Id: userID}}
|
||||
authProxy := authproxy.ProvideAuthProxy(cfg, remoteCacheSvc, loginService, &FakeGetSignUserStore{})
|
||||
|
||||
@@ -269,8 +269,7 @@ func TestEmailNotifierIntegration(t *testing.T) {
|
||||
func createCoreEmailService(t *testing.T) *notifications.NotificationService {
|
||||
t.Helper()
|
||||
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
bus := bus.ProvideBus(tracer)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
|
||||
@@ -14,8 +14,7 @@ import (
|
||||
|
||||
func newBus(t *testing.T) bus.Bus {
|
||||
t.Helper()
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
return bus.ProvideBus(tracer)
|
||||
}
|
||||
|
||||
|
||||
@@ -473,8 +473,7 @@ type scenarioContext struct {
|
||||
func scenario(t *testing.T, desc string, input scenarioInput, f func(ctx *scenarioContext)) {
|
||||
t.Helper()
|
||||
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
|
||||
sCtx := &scenarioContext{
|
||||
t: t,
|
||||
|
||||
@@ -542,10 +542,7 @@ func initTestDB(migration registry.DatabaseMigrator, opts ...InitTestDBOpt) (*SQ
|
||||
engine.DatabaseTZ = time.UTC
|
||||
engine.TZLocation = time.UTC
|
||||
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
bus := bus.ProvideBus(tracer)
|
||||
testSQLStore, err = newSQLStore(cfg, localcache.New(5*time.Minute, 10*time.Minute), engine, migration, bus, tracer, opts...)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/teamguardian/database"
|
||||
"github.com/stretchr/testify/mock"
|
||||
@@ -33,11 +32,9 @@ func TestUpdateTeam(t *testing.T) {
|
||||
|
||||
t.Run("Given an editor and a team he isn't a member of", func(t *testing.T) {
|
||||
t.Run("Should not be able to update the team", func(t *testing.T) {
|
||||
_, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
ctx := context.Background()
|
||||
store.On("GetTeamMembers", ctx, mock.Anything).Return([]*models.TeamMemberDTO{}, nil).Once()
|
||||
err = teamGuardianService.CanAdmin(ctx, testTeam.OrgId, testTeam.Id, &editor)
|
||||
err := teamGuardianService.CanAdmin(ctx, testTeam.OrgId, testTeam.Id, &editor)
|
||||
require.Equal(t, models.ErrNotAllowedToUpdateTeam, err)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user