rule

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

README

UTs (Unit Tests)

The Makefile at root of the repository starts a local prometheus instances using docker that's being used for the unit test for this package. So if you just run make test, everything is taken care of.

If you want to just run the UTs for this package, make sure you start a prometheus server as below

docker run -d --name autopilot-prometheus-test -p 9090:9090 prom/prometheus:v2.11.1

And then run

go test -v -tags unittest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRuleObjectsForRule

func GetRuleObjectsForRule(autopilotRule *v1alpha1.AutopilotRule) (map[string]Rule, error)

GetRuleObjectsForRule returns a list of Rule interfaces for every individual object for which the input autopilot rule is configured for.

func GetUUIDFromRule

func GetUUIDFromRule(r *v1alpha1.AutopilotRule) string

GetUUIDFromRule is a helper function to get the uuid from the k8s autopilot rule object

Types

type Rule

type Rule interface {
	// Check performs a check on all the conditions for the rule and returns the
	// conditions that have been met
	Check() ([]*v1alpha1.LabelSelectorRequirement, error)
	// UUID returns the unique ID for the rule
	UUID() string
	// DoAction performs the actions for the rule
	DoActions() error
	// Name returns a name of the rule
	ParentRuleName() string
}

Rule interface represents a rule inside the RuleEngine

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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