mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
37 lines
776 B
Go
37 lines
776 B
Go
|
package dashboards
|
||
|
|
||
|
import "context"
|
||
|
|
||
|
type Calls struct {
|
||
|
Provision []interface{}
|
||
|
PollChanges []interface{}
|
||
|
}
|
||
|
|
||
|
type DashboardProvisionerMock struct {
|
||
|
Calls *Calls
|
||
|
ProvisionFunc func() error
|
||
|
PollChangesFunc func(ctx context.Context)
|
||
|
}
|
||
|
|
||
|
func NewDashboardProvisionerMock() *DashboardProvisionerMock {
|
||
|
return &DashboardProvisionerMock{
|
||
|
Calls: &Calls{},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (dpm *DashboardProvisionerMock) Provision() error {
|
||
|
dpm.Calls.Provision = append(dpm.Calls.Provision, nil)
|
||
|
if dpm.ProvisionFunc != nil {
|
||
|
return dpm.ProvisionFunc()
|
||
|
} else {
|
||
|
return nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (dpm *DashboardProvisionerMock) PollChanges(ctx context.Context) {
|
||
|
dpm.Calls.PollChanges = append(dpm.Calls.PollChanges, ctx)
|
||
|
if dpm.PollChangesFunc != nil {
|
||
|
dpm.PollChangesFunc(ctx)
|
||
|
}
|
||
|
}
|