use const instead of recording and alerting string in api_test.go

Signed-off-by: sarthak.tyagi <sarthaktyagi100@gmail.com>
This commit is contained in:
sarthak.tyagi 2024-07-10 10:30:32 +01:00
parent c302ac5d8f
commit 94e83197ca
1 changed files with 4 additions and 4 deletions

View File

@ -771,14 +771,14 @@ func TestAPIs(t *testing.T) {
Name: "HighRequestLatency", Name: "HighRequestLatency",
Query: "job:request_latency_seconds:mean5m{job=\"myjob\"} > 0.5", Query: "job:request_latency_seconds:mean5m{job=\"myjob\"} > 0.5",
LastError: "", LastError: "",
Type: "alerting", Type: string(RuleTypeAlerting),
}, },
RecordingRule{ RecordingRule{
Health: RuleHealthGood, Health: RuleHealthGood,
Name: "job:http_inprogress_requests:sum", Name: "job:http_inprogress_requests:sum",
Query: "sum(http_inprogress_requests) by (job)", Query: "sum(http_inprogress_requests) by (job)",
LastError: "", LastError: "",
Type: "recording", Type: string(RuleTypeRecording),
}, },
}, },
}, },
@ -872,7 +872,7 @@ func TestAPIs(t *testing.T) {
}, },
Name: "HighRequestLatency", Name: "HighRequestLatency",
Query: "job:request_latency_seconds:mean5m{job=\"myjob\"} > 0.5", Query: "job:request_latency_seconds:mean5m{job=\"myjob\"} > 0.5",
Type: "alerting", Type: string(RuleTypeAlerting),
EvaluationTime: 0.5, EvaluationTime: 0.5,
LastEvaluation: time.Date(2020, 5, 18, 15, 52, 53, 450311300, time.UTC), LastEvaluation: time.Date(2020, 5, 18, 15, 52, 53, 450311300, time.UTC),
State: "firing", State: "firing",
@ -881,7 +881,7 @@ func TestAPIs(t *testing.T) {
Health: RuleHealthGood, Health: RuleHealthGood,
Name: "job:http_inprogress_requests:sum", Name: "job:http_inprogress_requests:sum",
Query: "sum(http_inprogress_requests) by (job)", Query: "sum(http_inprogress_requests) by (job)",
Type: "recording", Type: string(RuleTypeRecording),
EvaluationTime: 0.3, EvaluationTime: 0.3,
LastEvaluation: time.Date(2020, 5, 18, 15, 52, 53, 450311300, time.UTC), LastEvaluation: time.Date(2020, 5, 18, 15, 52, 53, 450311300, time.UTC),
}, },