Documentation
¶
Index ¶
- Variables
- func AmtoolOk() (bool, error)
- func Version() (string, error)
- type AcceptanceOpts
- type AcceptanceTest
- type Alertmanager
- func (am *Alertmanager) AddAlerts(omitEquals bool, alerts ...*TestAlert)
- func (am *Alertmanager) AddAlertsAt(omitEquals bool, at float64, alerts ...*TestAlert)
- func (am *Alertmanager) DelSilence(at float64, sil *TestSilence)
- func (am *Alertmanager) ExpireSilenceByID(id string) ([]byte, error)
- func (am *Alertmanager) ExportSilences() ([]byte, error)
- func (am *Alertmanager) ImportSilences(filename string) ([]byte, error)
- func (am *Alertmanager) QueryAlerts(match ...string) ([]TestAlert, error)
- func (am *Alertmanager) QueryExpiredSilence(match ...string) ([]TestSilence, error)
- func (am *Alertmanager) QuerySilence(match ...string) ([]TestSilence, error)
- func (am *Alertmanager) SetSilence(at float64, sil *TestSilence)
- func (am *Alertmanager) ShowRoute() ([]byte, error)
- func (am *Alertmanager) TestRoute(labels ...string) ([]byte, error)
- type AlertmanagerCluster
- type Collector
- type Interval
- type MockWebhook
- type TestAlert
- type TestSilence
- func (s *TestSilence) Comment(c string) *TestSilence
- func (s *TestSilence) EndsAt() float64
- func (s *TestSilence) GetMatchREs() []string
- func (s TestSilence) GetMatches() []string
- func (s *TestSilence) ID() string
- func (s *TestSilence) Match(v ...string) *TestSilence
- func (s *TestSilence) MatchRE(v ...string) *TestSilence
- func (s *TestSilence) SetID(ID string)
Constants ¶
This section is empty.
Variables ¶
var ( At = testutils.At Between = testutils.Between Alert = testutils.Alert NewWebhook = testutils.NewWebhook )
var CompareCollectors = testutils.CompareCollectors
Functions ¶
Types ¶
type AcceptanceOpts ¶
type AcceptanceOpts = testutils.AcceptanceOpts
Re-export common types from testutils.
type AcceptanceTest ¶
type AcceptanceTest struct {
*testutils.AcceptanceTest
}
AcceptanceTest wraps testutils.AcceptanceTest for CLI-based testing.
func NewAcceptanceTest ¶
func NewAcceptanceTest(t *testing.T, opts *AcceptanceOpts) *AcceptanceTest
NewAcceptanceTest returns a new acceptance test.
func (*AcceptanceTest) AlertmanagerCluster ¶
func (t *AcceptanceTest) AlertmanagerCluster(conf string, size int) *AlertmanagerCluster
AlertmanagerCluster returns a new AlertmanagerCluster.
type Alertmanager ¶
type Alertmanager struct {
*testutils.Alertmanager
}
Alertmanager wraps testutils.Alertmanager and adds CLI-specific methods.
func (*Alertmanager) AddAlerts ¶
func (am *Alertmanager) AddAlerts(omitEquals bool, alerts ...*TestAlert)
AddAlerts declares alerts that are to be added to the Alertmanager server. The omitEquals option omits alertname= from the command line args passed to amtool and instead uses the alertname value as the first argument to the command. For example `amtool alert add foo` instead of `amtool alert add alertname=foo`. This has been added to allow certain tests to test adding alerts both with and without alertname=. All other tests that use AddAlerts as a fixture can set this to false.
func (*Alertmanager) AddAlertsAt ¶
func (am *Alertmanager) AddAlertsAt(omitEquals bool, at float64, alerts ...*TestAlert)
AddAlertsAt declares alerts that are to be added to the Alertmanager server at a relative point in time.
func (*Alertmanager) DelSilence ¶
func (am *Alertmanager) DelSilence(at float64, sil *TestSilence)
DelSilence deletes the silence with the sid at the given time.
func (*Alertmanager) ExpireSilenceByID ¶ added in v0.30.0
func (am *Alertmanager) ExpireSilenceByID(id string) ([]byte, error)
ExpireSilenceByID expires a silence by its ID using 'amtool silence expire'.
func (*Alertmanager) ExportSilences ¶ added in v0.30.0
func (am *Alertmanager) ExportSilences() ([]byte, error)
ExportSilences exports all silences to JSON format using 'amtool silence query -o json'.
func (*Alertmanager) ImportSilences ¶ added in v0.30.0
func (am *Alertmanager) ImportSilences(filename string) ([]byte, error)
ImportSilences imports silences from a JSON file using 'amtool silence import'.
func (*Alertmanager) QueryAlerts ¶
func (am *Alertmanager) QueryAlerts(match ...string) ([]TestAlert, error)
QueryAlerts uses the amtool cli to query alerts.
func (*Alertmanager) QueryExpiredSilence ¶ added in v0.30.0
func (am *Alertmanager) QueryExpiredSilence(match ...string) ([]TestSilence, error)
QueryExpiredSilence queries expired silences using the 'amtool silence query --expired --within' command.
func (*Alertmanager) QuerySilence ¶
func (am *Alertmanager) QuerySilence(match ...string) ([]TestSilence, error)
QuerySilence queries the current silences using the 'amtool silence query' command.
func (*Alertmanager) SetSilence ¶
func (am *Alertmanager) SetSilence(at float64, sil *TestSilence)
SetSilence updates or creates the given Silence.
func (*Alertmanager) ShowRoute ¶ added in v0.27.0
func (am *Alertmanager) ShowRoute() ([]byte, error)
ShowRoute shows the routing tree using 'amtool config routes show'.
type AlertmanagerCluster ¶
type AlertmanagerCluster struct {
*testutils.AlertmanagerCluster
}
AlertmanagerCluster wraps testutils.AlertmanagerCluster and adds CLI-specific methods.
func (*AlertmanagerCluster) DelSilence ¶
func (amc *AlertmanagerCluster) DelSilence(at float64, sil *TestSilence)
DelSilence deletes the silence with the sid at the given time.
func (*AlertmanagerCluster) Members ¶
func (amc *AlertmanagerCluster) Members() []*Alertmanager
Members returns the underlying Alertmanager instances wrapped for CLI testing.
func (*AlertmanagerCluster) SetSilence ¶
func (amc *AlertmanagerCluster) SetSilence(at float64, sil *TestSilence)
SetSilence updates or creates the given Silence.
type MockWebhook ¶
type MockWebhook = testutils.MockWebhook
Re-export common types and functions from testutils.
type TestSilence ¶
type TestSilence struct {
// contains filtered or unexported fields
}
TestSilence models a model.Silence with relative times. This is the CLI-specific version with additional fields.
func Silence ¶
func Silence(start, end float64) *TestSilence
Silence creates a new TestSilence active for the relative interval given by start and end.
func (*TestSilence) Comment ¶
func (s *TestSilence) Comment(c string) *TestSilence
Comment sets the comment to the silence.
func (*TestSilence) EndsAt ¶ added in v0.30.0
func (s *TestSilence) EndsAt() float64
EndsAt gets the silence end time.
func (*TestSilence) GetMatchREs ¶ added in v0.27.0
func (s *TestSilence) GetMatchREs() []string
GetMatchREs returns the regex matchers for the silence.
func (TestSilence) GetMatches ¶ added in v0.27.0
func (s TestSilence) GetMatches() []string
GetMatches returns the plain matchers for the silence.
func (*TestSilence) Match ¶
func (s *TestSilence) Match(v ...string) *TestSilence
Match adds a new plain matcher to the silence.
func (*TestSilence) MatchRE ¶
func (s *TestSilence) MatchRE(v ...string) *TestSilence
MatchRE adds a new regex matcher to the silence.