Alerting: Break dependency between state and image packages (#58381)

* Refactor state and manager to not depend directly on image interface

* Move generic errors to models package

* Move NotAvailableImageService to state as its only references are in state tests

* Move NoopImageService to state package

* Move mock to state package

* Fix linter error

* Fix comment styling

* Fix a couple added references introduced by rebase

* Empty commit to kick build
This commit is contained in:
Alexander Weaver
2022-11-09 15:06:49 -06:00
committed by GitHub
parent bad4f28d0d
commit 2bfdda5b68
11 changed files with 108 additions and 109 deletions

View File

@@ -25,3 +25,10 @@ type Historian interface {
// RecordStates writes a number of state transitions for a given rule to state history.
RecordStates(ctx context.Context, rule *models.AlertRule, states []StateTransition)
}
// ImageCapturer captures images.
//
//go:generate mockgen -destination=image_mock.go -package=state github.com/grafana/grafana/pkg/services/ngalert/state ImageCapturer
type ImageCapturer interface {
NewImage(ctx context.Context, r *models.AlertRule) (*models.Image, error)
}