mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 01:41:24 -06:00
Fix nil logger in SqlStore (#54726)
This commit is contained in:
parent
d5d7e920a0
commit
c4d32dd687
@ -52,7 +52,7 @@ func (dc *CacheServiceImpl) GetDatasource(
|
||||
dc.logger.Debug("Querying for data source via SQL store", "id", datasourceID, "orgId", user.OrgID)
|
||||
|
||||
query := &datasources.GetDataSourceQuery{Id: datasourceID, OrgId: user.OrgID}
|
||||
ss := SqlStore{db: dc.SQLStore}
|
||||
ss := SqlStore{db: dc.SQLStore, logger: dc.logger}
|
||||
err := ss.GetDataSource(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -92,7 +92,7 @@ func (dc *CacheServiceImpl) GetDatasourceByUID(
|
||||
|
||||
dc.logger.Debug("Querying for data source via SQL store", "uid", datasourceUID, "orgId", user.OrgID)
|
||||
query := &datasources.GetDataSourceQuery{Uid: datasourceUID, OrgId: user.OrgID}
|
||||
ss := SqlStore{db: dc.SQLStore}
|
||||
ss := SqlStore{db: dc.SQLStore, logger: dc.logger}
|
||||
err := ss.GetDataSource(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -36,8 +36,8 @@ type SqlStore struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func CreateStore(db sqlstore.Store) *SqlStore {
|
||||
return &SqlStore{db: db}
|
||||
func CreateStore(db sqlstore.Store, logger log.Logger) *SqlStore {
|
||||
return &SqlStore{db: db, logger: logger}
|
||||
}
|
||||
|
||||
// GetDataSource adds a datasource to the query model by querying by org_id as well as
|
||||
|
@ -38,7 +38,7 @@ func TestMigrate(t *testing.T) {
|
||||
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
|
||||
secretsStore := secretskvs.NewSQLSecretsKVStore(sqlStore, secretsService, log.New("test.logger"))
|
||||
migService := SetupTestDataSourceSecretMigrationService(t, sqlStore, kvStore, secretsStore, false)
|
||||
ds := dsservice.CreateStore(sqlStore)
|
||||
ds := dsservice.CreateStore(sqlStore, log.NewNopLogger())
|
||||
dataSourceName := "Test"
|
||||
dataSourceOrg := int64(1)
|
||||
err := ds.AddDataSource(context.Background(), &datasources.AddDataSourceCommand{
|
||||
@ -102,7 +102,7 @@ func TestMigrate(t *testing.T) {
|
||||
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
|
||||
secretsStore := secretskvs.NewSQLSecretsKVStore(sqlStore, secretsService, log.New("test.logger"))
|
||||
migService := SetupTestDataSourceSecretMigrationService(t, sqlStore, kvStore, secretsStore, true)
|
||||
ds := dsservice.CreateStore(sqlStore)
|
||||
ds := dsservice.CreateStore(sqlStore, log.NewNopLogger())
|
||||
dataSourceName := "Test"
|
||||
dataSourceOrg := int64(1)
|
||||
|
||||
@ -169,7 +169,7 @@ func TestMigrate(t *testing.T) {
|
||||
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
|
||||
secretsStore := secretskvs.NewSQLSecretsKVStore(sqlStore, secretsService, log.New("test.logger"))
|
||||
migService := SetupTestDataSourceSecretMigrationService(t, sqlStore, kvStore, secretsStore, false)
|
||||
ds := dsservice.CreateStore(sqlStore)
|
||||
ds := dsservice.CreateStore(sqlStore, log.NewNopLogger())
|
||||
|
||||
dataSourceName := "Test"
|
||||
dataSourceOrg := int64(1)
|
||||
@ -260,7 +260,7 @@ func TestMigrate(t *testing.T) {
|
||||
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
|
||||
secretsStore := secretskvs.NewSQLSecretsKVStore(sqlStore, secretsService, log.New("test.logger"))
|
||||
migService := SetupTestDataSourceSecretMigrationService(t, sqlStore, kvStore, secretsStore, true)
|
||||
ds := dsservice.CreateStore(sqlStore)
|
||||
ds := dsservice.CreateStore(sqlStore, log.NewNopLogger())
|
||||
|
||||
dataSourceName := "Test"
|
||||
dataSourceOrg := int64(1)
|
||||
|
Loading…
Reference in New Issue
Block a user