Alerting: Add UID of rules to response that were affected by update group request (#75985)
* update storage's method InstertRules to return ids of added rules as slice to keep the same order as rules in the argument * schematize response of update rule group endpoint, add created, updated, deleted fields that contain UID of affected rules. * update integration tests to use the new fields
This commit is contained in:
@@ -328,7 +328,7 @@ func (a apiClient) UpdateAlertRuleOrgQuota(t *testing.T, orgID int64, limit int6
|
||||
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
}
|
||||
|
||||
func (a apiClient) PostRulesGroup(t *testing.T, folder string, group *apimodels.PostableRuleGroupConfig) (int, string) {
|
||||
func (a apiClient) PostRulesGroupWithStatus(t *testing.T, folder string, group *apimodels.PostableRuleGroupConfig) (apimodels.UpdateRuleGroupResponse, int, string) {
|
||||
t.Helper()
|
||||
buf := bytes.Buffer{}
|
||||
enc := json.NewEncoder(&buf)
|
||||
@@ -344,7 +344,11 @@ func (a apiClient) PostRulesGroup(t *testing.T, folder string, group *apimodels.
|
||||
}()
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
require.NoError(t, err)
|
||||
return resp.StatusCode, string(b)
|
||||
var m apimodels.UpdateRuleGroupResponse
|
||||
if resp.StatusCode == http.StatusAccepted {
|
||||
require.NoError(t, json.Unmarshal(b, &m))
|
||||
}
|
||||
return m, resp.StatusCode, string(b)
|
||||
}
|
||||
|
||||
func (a apiClient) PostRulesExportWithStatus(t *testing.T, folder string, group *apimodels.PostableRuleGroupConfig, params *apimodels.ExportQueryParams) (int, string) {
|
||||
|
||||
Reference in New Issue
Block a user