api: fix typo in list rules API response (#15400)

* Fix typo in list rules API response

---------

Signed-off-by: Raphael Silva <rapphil@gmail.com>
pull/15300/head
Raphael Philipe Mendes da Silva 2024-11-24 08:28:21 -08:00 committed by GitHub
parent 63d87a60a8
commit e664c16b31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -1374,7 +1374,7 @@ func (api *API) metricMetadata(r *http.Request) apiFuncResult {
// RuleDiscovery has info for all rules.
type RuleDiscovery struct {
RuleGroups []*RuleGroup `json:"groups"`
GroupNextToken string `json:"groupNextToken:omitempty"`
GroupNextToken string `json:"groupNextToken,omitempty"`
}
// RuleGroup has info for rules which are part of a group.

View File

@ -2899,6 +2899,14 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
errType: errorBadData,
zeroFunc: rulesZeroFunc,
},
{ // groupNextToken should not be in empty response
endpoint: api.rules,
query: url.Values{
"match[]": []string{`{testlabel="abc-cannot-find"}`},
"group_limit": []string{"1"},
},
responseAsJSON: `{"groups":[]}`,
},
{
endpoint: api.queryExemplars,
query: url.Values{