Add default time interval config to match test cases

Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
Ben Ridley 2023-09-29 10:25:51 +10:00
parent 2269bbc03b
commit 148f4a823a
1 changed files with 216 additions and 162 deletions

View File

@ -108,12 +108,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{owner=\"team-A\"}"},
@ -125,12 +127,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{owner=\"team-A\"}"},
@ -141,12 +145,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-BC",
GroupBy: lset("foo", "bar"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-BC",
GroupBy: lset("foo", "bar"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{owner=~\"^(?:team-(B|C))$\"}"},
@ -158,12 +164,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset(),
GroupByAll: true,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset(),
GroupByAll: true,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{owner=\"team-A\"}/{env=\"testing\"}"},
@ -175,20 +183,24 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-productionA",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: 1 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-productionA",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: 1 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
{
Receiver: "notify-productionB",
GroupBy: lset("job"),
GroupByAll: false,
GroupWait: 30 * time.Second,
GroupInterval: 5 * time.Minute,
RepeatInterval: 1 * time.Hour,
Receiver: "notify-productionB",
GroupBy: lset("job"),
GroupByAll: false,
GroupWait: 30 * time.Second,
GroupInterval: 5 * time.Minute,
RepeatInterval: 1 * time.Hour,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{
@ -202,12 +214,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-def",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-def",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}"},
@ -219,12 +233,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}/{env=\"testing\"}"},
@ -237,12 +253,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}/{env=\"testing\"}/{wait=\"long\"}"},
@ -520,12 +538,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{level!=\"critical\",owner=\"team-A\"}"},
@ -537,12 +557,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{level!=\"critical\",owner=\"team-A\"}"},
@ -553,12 +575,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-BC",
GroupBy: lset("foo", "bar"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-BC",
GroupBy: lset("foo", "bar"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{owner=~\"team-(B|C)\"}"},
@ -570,12 +594,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset(),
GroupByAll: true,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset(),
GroupByAll: true,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{level!=\"critical\",owner=\"team-A\"}/{baz!~\".*quux\",env=\"testing\"}"},
@ -587,20 +613,24 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-productionA",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: 1 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-productionA",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: 1 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
{
Receiver: "notify-productionB",
GroupBy: lset("job"),
GroupByAll: false,
GroupWait: 30 * time.Second,
GroupInterval: 5 * time.Minute,
RepeatInterval: 1 * time.Hour,
Receiver: "notify-productionB",
GroupBy: lset("job"),
GroupByAll: false,
GroupWait: 30 * time.Second,
GroupInterval: 5 * time.Minute,
RepeatInterval: 1 * time.Hour,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{
@ -614,12 +644,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-def",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-def",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}"},
@ -631,12 +663,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}/{env=\"testing\"}"},
@ -649,12 +683,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}/{env=\"testing\"}/{wait=\"long\"}"},
@ -756,12 +792,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{level!=\"critical\",owner=\"team-A\"}"},
@ -773,12 +811,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-A",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{level!=\"critical\",owner=\"team-A\"}"},
@ -789,12 +829,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-BC",
GroupBy: lset("foo", "bar"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-BC",
GroupBy: lset("foo", "bar"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{owner=~\"^(?:team-(B|C))$\"}"},
@ -806,12 +848,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset(),
GroupByAll: true,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset(),
GroupByAll: true,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{level!=\"critical\",owner=\"team-A\"}/{baz!~\".*quux\",env=\"testing\"}"},
@ -823,20 +867,24 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-productionA",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: 1 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-productionA",
GroupBy: def.GroupBy,
GroupByAll: false,
GroupWait: 1 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
{
Receiver: "notify-productionB",
GroupBy: lset("job"),
GroupByAll: false,
GroupWait: 30 * time.Second,
GroupInterval: 5 * time.Minute,
RepeatInterval: 1 * time.Hour,
Receiver: "notify-productionB",
GroupBy: lset("job"),
GroupByAll: false,
GroupWait: 30 * time.Second,
GroupInterval: 5 * time.Minute,
RepeatInterval: 1 * time.Hour,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{
@ -850,12 +898,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-def",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-def",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}"},
@ -867,12 +917,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: def.GroupWait,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}/{env=\"testing\"}"},
@ -885,12 +937,14 @@ routes:
},
result: []*RouteOpts{
{
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
Receiver: "notify-testing",
GroupBy: lset("role"),
GroupByAll: false,
GroupWait: 2 * time.Minute,
GroupInterval: def.GroupInterval,
RepeatInterval: def.RepeatInterval,
MuteTimeIntervals: def.MuteTimeIntervals,
ActiveTimeIntervals: def.ActiveTimeIntervals,
},
},
keys: []string{"{}/{group_by=\"role\"}/{env=\"testing\"}/{wait=\"long\"}"},