feat(mock): scraper service mock
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>pull/10616/head
parent
14b5f103c4
commit
c90f79d28a
|
@ -0,0 +1,43 @@
|
|||
package mock
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/platform"
|
||||
)
|
||||
|
||||
var _ platform.ScraperTargetStoreService = &ScraperTargetStoreService{}
|
||||
|
||||
// ScraperTargetStoreService is a mock implementation of a platform.ScraperTargetStoreService.
|
||||
type ScraperTargetStoreService struct {
|
||||
ListTargetsF func(ctx context.Context) ([]platform.ScraperTarget, error)
|
||||
AddTargetF func(ctx context.Context, t *platform.ScraperTarget) error
|
||||
GetTargetByIDF func(ctx context.Context, id platform.ID) (*platform.ScraperTarget, error)
|
||||
RemoveTargetF func(ctx context.Context, id platform.ID) error
|
||||
UpdateTargetF func(ctx context.Context, t *platform.ScraperTarget) (*platform.ScraperTarget, error)
|
||||
}
|
||||
|
||||
// ListTargets lists all the scraper targets.
|
||||
func (s *ScraperTargetStoreService) ListTargets(ctx context.Context) ([]platform.ScraperTarget, error) {
|
||||
return s.ListTargetsF(ctx)
|
||||
}
|
||||
|
||||
// AddTarget adds a scraper target.
|
||||
func (s *ScraperTargetStoreService) AddTarget(ctx context.Context, t *platform.ScraperTarget) error {
|
||||
return s.AddTargetF(ctx, t)
|
||||
}
|
||||
|
||||
// GetTargetByID retrieves a scraper target by id.
|
||||
func (s *ScraperTargetStoreService) GetTargetByID(ctx context.Context, id platform.ID) (*platform.ScraperTarget, error) {
|
||||
return s.GetTargetByIDF(ctx, id)
|
||||
}
|
||||
|
||||
// RemoveTarget deletes a scraper target.
|
||||
func (s *ScraperTargetStoreService) RemoveTarget(ctx context.Context, id platform.ID) error {
|
||||
return s.RemoveTargetF(ctx, id)
|
||||
}
|
||||
|
||||
// UpdateTarget updates a scraper target.
|
||||
func (s *ScraperTargetStoreService) UpdateTarget(ctx context.Context, t *platform.ScraperTarget) (*platform.ScraperTarget, error) {
|
||||
return s.UpdateTargetF(ctx, t)
|
||||
}
|
|
@ -24,7 +24,6 @@ type TaskService struct {
|
|||
|
||||
func (s *TaskService) FindTaskByID(ctx context.Context, id platform.ID) (*platform.Task, error) {
|
||||
return s.FindTaskByIDFn(ctx, id)
|
||||
|
||||
}
|
||||
|
||||
func (s *TaskService) FindTasks(ctx context.Context, filter platform.TaskFilter) ([]*platform.Task, int, error) {
|
||||
|
|
Loading…
Reference in New Issue