mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
cmd/prometheus: in tests use labels.FromStrings
Replacing code which assumes the internal structure of `Labels`. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
b01d29cf9e
commit
735914f692
|
@ -147,8 +147,8 @@ func TestSendAlerts(t *testing.T) {
|
||||||
{
|
{
|
||||||
in: []*rules.Alert{
|
in: []*rules.Alert{
|
||||||
{
|
{
|
||||||
Labels: []labels.Label{{Name: "l1", Value: "v1"}},
|
Labels: labels.FromStrings("l1", "v1"),
|
||||||
Annotations: []labels.Label{{Name: "a2", Value: "v2"}},
|
Annotations: labels.FromStrings("a2", "v2"),
|
||||||
ActiveAt: time.Unix(1, 0),
|
ActiveAt: time.Unix(1, 0),
|
||||||
FiredAt: time.Unix(2, 0),
|
FiredAt: time.Unix(2, 0),
|
||||||
ValidUntil: time.Unix(3, 0),
|
ValidUntil: time.Unix(3, 0),
|
||||||
|
@ -156,8 +156,8 @@ func TestSendAlerts(t *testing.T) {
|
||||||
},
|
},
|
||||||
exp: []*notifier.Alert{
|
exp: []*notifier.Alert{
|
||||||
{
|
{
|
||||||
Labels: []labels.Label{{Name: "l1", Value: "v1"}},
|
Labels: labels.FromStrings("l1", "v1"),
|
||||||
Annotations: []labels.Label{{Name: "a2", Value: "v2"}},
|
Annotations: labels.FromStrings("a2", "v2"),
|
||||||
StartsAt: time.Unix(2, 0),
|
StartsAt: time.Unix(2, 0),
|
||||||
EndsAt: time.Unix(3, 0),
|
EndsAt: time.Unix(3, 0),
|
||||||
GeneratorURL: "http://localhost:9090/graph?g0.expr=up&g0.tab=1",
|
GeneratorURL: "http://localhost:9090/graph?g0.expr=up&g0.tab=1",
|
||||||
|
@ -167,8 +167,8 @@ func TestSendAlerts(t *testing.T) {
|
||||||
{
|
{
|
||||||
in: []*rules.Alert{
|
in: []*rules.Alert{
|
||||||
{
|
{
|
||||||
Labels: []labels.Label{{Name: "l1", Value: "v1"}},
|
Labels: labels.FromStrings("l1", "v1"),
|
||||||
Annotations: []labels.Label{{Name: "a2", Value: "v2"}},
|
Annotations: labels.FromStrings("a2", "v2"),
|
||||||
ActiveAt: time.Unix(1, 0),
|
ActiveAt: time.Unix(1, 0),
|
||||||
FiredAt: time.Unix(2, 0),
|
FiredAt: time.Unix(2, 0),
|
||||||
ResolvedAt: time.Unix(4, 0),
|
ResolvedAt: time.Unix(4, 0),
|
||||||
|
@ -176,8 +176,8 @@ func TestSendAlerts(t *testing.T) {
|
||||||
},
|
},
|
||||||
exp: []*notifier.Alert{
|
exp: []*notifier.Alert{
|
||||||
{
|
{
|
||||||
Labels: []labels.Label{{Name: "l1", Value: "v1"}},
|
Labels: labels.FromStrings("l1", "v1"),
|
||||||
Annotations: []labels.Label{{Name: "a2", Value: "v2"}},
|
Annotations: labels.FromStrings("a2", "v2"),
|
||||||
StartsAt: time.Unix(2, 0),
|
StartsAt: time.Unix(2, 0),
|
||||||
EndsAt: time.Unix(4, 0),
|
EndsAt: time.Unix(4, 0),
|
||||||
GeneratorURL: "http://localhost:9090/graph?g0.expr=up&g0.tab=1",
|
GeneratorURL: "http://localhost:9090/graph?g0.expr=up&g0.tab=1",
|
||||||
|
|
Loading…
Reference in a new issue