chore(datasources): Adding debug logging to datasource provisioning when resource is not found in SqlStore (#107652)

pull/106972/merge
Andres Torres 2 weeks ago committed by GitHub
parent b9fba95849
commit c2b7acae35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      pkg/services/datasources/service/store.go
  2. 10
      pkg/services/datasources/service/store_test.go

@ -83,6 +83,7 @@ func (ss *SqlStore) getDataSource(_ context.Context, query *datasources.GetDataS
ss.logger.Error("Failed getting data source", "err", err, "uid", query.UID, "id", query.ID, "name", query.Name, "orgId", query.OrgID) // nolint:staticcheck
return nil, err
} else if !has {
ss.logger.Debug("Data source not found", "uid", query.UID, "id", query.ID, "name", query.Name, "orgId", query.OrgID) // nolint:staticcheck
return nil, datasources.ErrDataSourceNotFound
}

@ -281,7 +281,10 @@ func TestIntegrationDataAccess(t *testing.T) {
t.Run("Can not delete datasource with wrong orgID", func(t *testing.T) {
db := db.InitTestDB(t)
ds := initDatasource(db)
ss := SqlStore{db: db}
ss := SqlStore{
db: db,
logger: log.NewNopLogger(),
}
err := ss.DeleteDataSource(context.Background(),
&datasources.DeleteDataSourceCommand{ID: ds.ID, OrgID: 123123})
@ -322,7 +325,10 @@ func TestIntegrationDataAccess(t *testing.T) {
t.Run("does not fire an event when the datasource is not deleted", func(t *testing.T) {
db := db.InitTestDB(t)
ss := SqlStore{db: db}
ss := SqlStore{
db: db,
logger: log.NewNopLogger(),
}
var called bool
db.Bus().AddEventListener(func(ctx context.Context, e *events.DataSourceDeleted) error {

Loading…
Cancel
Save