fakes

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericRecordedQuery

type GenericRecordedQuery struct {
	Name   string
	Params []interface{}
}

type RuleStore

type RuleStore struct {

	// OrgID -> RuleGroup -> Namespace -> Rules
	Rules       map[int64][]*models.AlertRule
	Hook        func(cmd interface{}) error // use Hook if you need to intercept some query and return an error
	RecordedOps []interface{}
	Folders     map[int64][]*folder.Folder
	// contains filtered or unexported fields
}

FakeRuleStore mocks the RuleStore of the scheduler.

func NewRuleStore

func NewRuleStore(t *testing.T) *RuleStore

func (*RuleStore) Count

func (f *RuleStore) Count(ctx context.Context, orgID int64) (int64, error)

func (*RuleStore) CountInFolder

func (f *RuleStore) CountInFolder(ctx context.Context, orgID int64, folderUID string, u *user.SignedInUser) (int64, error)

func (*RuleStore) DeleteAlertRulesByUID

func (f *RuleStore) DeleteAlertRulesByUID(_ context.Context, orgID int64, UIDs ...string) error

func (*RuleStore) GetAlertRuleByUID

func (f *RuleStore) GetAlertRuleByUID(_ context.Context, q *models.GetAlertRuleByUIDQuery) (*models.AlertRule, error)

func (*RuleStore) GetAlertRulesGroupByRuleUID

func (f *RuleStore) GetAlertRulesGroupByRuleUID(_ context.Context, q *models.GetAlertRulesGroupByRuleUIDQuery) ([]*models.AlertRule, error)

func (*RuleStore) GetNamespaceByTitle

func (f *RuleStore) GetNamespaceByTitle(_ context.Context, title string, orgID int64, _ *user.SignedInUser) (*folder.Folder, error)

func (*RuleStore) GetNamespaceByUID

func (f *RuleStore) GetNamespaceByUID(_ context.Context, uid string, orgID int64, _ *user.SignedInUser) (*folder.Folder, error)

func (*RuleStore) GetRecordedCommands

func (f *RuleStore) GetRecordedCommands(predicate func(cmd interface{}) (interface{}, bool)) []interface{}

GetRecordedCommands filters recorded commands using predicate function. Returns the subset of the recorded commands that meet the predicate

func (*RuleStore) GetRuleGroupInterval

func (f *RuleStore) GetRuleGroupInterval(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string) (int64, error)

func (*RuleStore) GetUserVisibleNamespaces

func (f *RuleStore) GetUserVisibleNamespaces(_ context.Context, orgID int64, _ *user.SignedInUser) (map[string]*folder.Folder, error)

func (*RuleStore) InTransaction

func (f *RuleStore) InTransaction(ctx context.Context, fn func(c context.Context) error) error

func (*RuleStore) IncreaseVersionForAllRulesInNamespace

func (f *RuleStore) IncreaseVersionForAllRulesInNamespace(_ context.Context, orgID int64, namespaceUID string) ([]models.AlertRuleKeyWithVersionAndPauseStatus, error)

func (*RuleStore) InsertAlertRules

func (f *RuleStore) InsertAlertRules(_ context.Context, q []models.AlertRule) (map[string]int64, error)

func (*RuleStore) ListAlertRules

func (*RuleStore) PutRule

func (f *RuleStore) PutRule(_ context.Context, rules ...*models.AlertRule)

PutRule puts the rule in the Rules map. If there are existing rule in the same namespace, they will be overwritten

func (*RuleStore) UpdateAlertRules

func (f *RuleStore) UpdateAlertRules(_ context.Context, q []models.UpdateRule) error

func (*RuleStore) UpdateRuleGroup

func (f *RuleStore) UpdateRuleGroup(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string, interval int64) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL