mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix audit log prefix for public dashboards (#53070)
This commit is contained in:
@@ -21,6 +21,8 @@ type PublicDashboardStoreImpl struct {
|
||||
dialect migrator.Dialect
|
||||
}
|
||||
|
||||
var LogPrefix = "publicdashboards.store"
|
||||
|
||||
// Gives us a compile time error if our database does not adhere to contract of
|
||||
// the interface
|
||||
var _ publicdashboards.Store = (*PublicDashboardStoreImpl)(nil)
|
||||
@@ -29,7 +31,7 @@ var _ publicdashboards.Store = (*PublicDashboardStoreImpl)(nil)
|
||||
func ProvideStore(sqlStore *sqlstore.SQLStore) *PublicDashboardStoreImpl {
|
||||
return &PublicDashboardStoreImpl{
|
||||
sqlStore: sqlStore,
|
||||
log: log.New("publicdashboards.store"),
|
||||
log: log.New(LogPrefix),
|
||||
dialect: sqlStore.Dialect,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ var DefaultTimeSettings, _ = simplejson.NewJson([]byte(`{}`))
|
||||
// Default time to pass in with seconds rounded
|
||||
var DefaultTime = time.Now().UTC().Round(time.Second)
|
||||
|
||||
func TestLogPrefix(t *testing.T) {
|
||||
assert.Equal(t, LogPrefix, "publicdashboards.store")
|
||||
}
|
||||
|
||||
func TestIntegrationGetDashboard(t *testing.T) {
|
||||
var sqlStore *sqlstore.SQLStore
|
||||
var dashboardStore *dashboardsDB.DashboardStore
|
||||
|
||||
@@ -25,6 +25,8 @@ type PublicDashboardServiceImpl struct {
|
||||
store publicdashboards.Store
|
||||
}
|
||||
|
||||
var LogPrefix = "publicdashboards.service"
|
||||
|
||||
// Gives us compile time error if the service does not adhere to the contract of
|
||||
// the interface
|
||||
var _ publicdashboards.Service = (*PublicDashboardServiceImpl)(nil)
|
||||
@@ -36,7 +38,7 @@ func ProvideService(
|
||||
store publicdashboards.Store,
|
||||
) *PublicDashboardServiceImpl {
|
||||
return &PublicDashboardServiceImpl{
|
||||
log: log.New("publicdashboards"),
|
||||
log: log.New(LogPrefix),
|
||||
cfg: cfg,
|
||||
store: store,
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ var defaultPubdashTimeSettings, _ = simplejson.NewJson([]byte(`{}`))
|
||||
var dashboardData = simplejson.NewFromAny(map[string]interface{}{"time": map[string]interface{}{"from": "now-8", "to": "now"}})
|
||||
var mergedDashboardData = simplejson.NewFromAny(map[string]interface{}{"time": map[string]interface{}{"from": "now-12", "to": "now"}})
|
||||
|
||||
func TestLogPrefix(t *testing.T) {
|
||||
assert.Equal(t, LogPrefix, "publicdashboards.service")
|
||||
}
|
||||
|
||||
func TestGetPublicDashboard(t *testing.T) {
|
||||
type storeResp struct {
|
||||
pd *PublicDashboard
|
||||
|
||||
Reference in New Issue
Block a user