Alerting: Update alerting module to 3befd25883e0d17673e5590cc5c5702bbc031b16 (#114062)

* [create-pull-request] automated change

* fix module path for alerting notify test receivers

---------

Co-authored-by: moustafab <27738648+moustafab@users.noreply.github.com>
Co-authored-by: Moustafa Baiou <moustafa.baiou@grafana.com>
This commit is contained in:
alerting-team[bot]
2025-11-19 21:24:08 +00:00
committed by GitHub
co-authored by moustafab Moustafa Baiou
parent 7264803016
commit 53c39ccda3
17 changed files with 125 additions and 21 deletions
@@ -2023,7 +2023,16 @@ func TestApiContactPointExportSnapshot(t *testing.T) {
exportRaw, err := receiverExportResponses.ReadFile(p)
require.NoError(t, err)
require.Equal(t, string(exportRaw), string(actualBody))
switch tc.exportType {
case "json":
require.JSONEq(t, string(exportRaw), string(actualBody))
case "yaml":
require.YAMLEq(t, string(exportRaw), string(actualBody))
case "hcl":
require.Equal(t, string(exportRaw), string(actualBody))
default:
t.Fatalf("unknown export type %q", tc.exportType)
}
}
t.Run("contact point export for all known configs", func(t *testing.T) {
@@ -38,6 +38,8 @@ resource "grafana_contact_point" "contact_point_2b661702215368fe" {
url = "[REDACTED]"
title = "test-title"
message = "test-message"
hide_open_button = true
hide_version_info = true
}
jira {
@@ -101,6 +101,8 @@
"uid": "googlechat-uid",
"type": "googlechat",
"settings": {
"hide_open_button": true,
"hide_version_info": true,
"http_config": {
"oauth2": {
"client_id": "test-client-id",
@@ -119,6 +119,8 @@ contactPoints:
- uid: googlechat-uid
type: googlechat
settings:
hide_open_button: true
hide_version_info: true
http_config:
oauth2:
client_id: test-client-id
@@ -30,9 +30,11 @@ resource "grafana_contact_point" "contact_point_2b661702215368fe" {
}
googlechat {
url = "http://localhost"
title = "test-title"
message = "test-message"
url = "http://localhost"
title = "test-title"
message = "test-message"
hide_open_button = true
hide_version_info = true
}
jira {
@@ -101,6 +101,8 @@
"uid": "googlechat-uid",
"type": "googlechat",
"settings": {
"hide_open_button": true,
"hide_version_info": true,
"http_config": {
"oauth2": {
"client_id": "test-client-id",
@@ -119,6 +119,8 @@ contactPoints:
- uid: googlechat-uid
type: googlechat
settings:
hide_open_button: true
hide_version_info: true
http_config:
oauth2:
client_id: test-client-id
@@ -58,8 +58,10 @@ type GooglechatIntegration struct {
URL Secret `json:"url" yaml:"url" hcl:"url"`
Title *string `json:"title,omitempty" yaml:"title,omitempty" hcl:"title"`
Message *string `json:"message,omitempty" yaml:"message,omitempty" hcl:"message"`
Title *string `json:"title,omitempty" yaml:"title,omitempty" hcl:"title"`
Message *string `json:"message,omitempty" yaml:"message,omitempty" hcl:"message"`
HideOpenButton *bool `json:"hide_open_button,omitempty" yaml:"hide_open_button,omitempty" hcl:"hide_open_button"`
HideVersionInfo *bool `json:"hide_version_info,omitempty" yaml:"hide_version_info,omitempty" hcl:"hide_version_info"`
}
type JiraIntegration struct {
@@ -44,7 +44,7 @@ func (am *alertmanager) TestReceivers(ctx context.Context, c apimodels.TestRecei
}
AddDefaultLabelsAndAnnotations(a)
return am.Base.TestReceivers(ctx, alertingNotify.TestReceiversConfigBodyParams{
Alert: &alertingNotify.TestReceiversConfigAlertParams{
Alert: &models.TestReceiversConfigAlertParams{
Annotations: v2.APILabelSetToModelLabelSet(a.Annotations),
Labels: v2.APILabelSetToModelLabelSet(a.Labels),
},
+2 -2
View File
@@ -625,9 +625,9 @@ func (am *Alertmanager) TestReceivers(ctx context.Context, c apimodels.TestRecei
}
apiReceivers := alertingNotify.PostableAPIReceiversToAPIReceivers(decryptedReceivers)
var alert *alertingNotify.TestReceiversConfigAlertParams
var alert *alertingModels.TestReceiversConfigAlertParams
if c.Alert != nil {
alert = &alertingNotify.TestReceiversConfigAlertParams{Annotations: c.Alert.Annotations, Labels: c.Alert.Labels}
alert = &alertingModels.TestReceiversConfigAlertParams{Annotations: c.Alert.Annotations, Labels: c.Alert.Labels}
}
return am.mimirClient.TestReceivers(ctx, alertingNotify.TestReceiversConfigBodyParams{
@@ -392,6 +392,42 @@
"secure": false,
"dependsOn": "",
"subformOptions": null
},
{
"element": "checkbox",
"inputType": "",
"label": "HideOpenButton",
"description": "Hide open URL button",
"placeholder": "",
"propertyName": "hide_open_button",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false,
"dependsOn": "",
"subformOptions": null
},
{
"element": "checkbox",
"inputType": "",
"label": "HideVersionInfo",
"description": "Hide version info",
"placeholder": "",
"propertyName": "hide_version_info",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false,
"dependsOn": "",
"subformOptions": null
}
]
},
@@ -1340,6 +1340,42 @@
"secure": false,
"dependsOn": "",
"subformOptions": null
},
{
"element": "checkbox",
"inputType": "",
"label": "HideOpenButton",
"description": "Hide open URL button",
"placeholder": "",
"propertyName": "hide_open_button",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false,
"dependsOn": "",
"subformOptions": null
},
{
"element": "checkbox",
"inputType": "",
"label": "HideVersionInfo",
"description": "Hide version info",
"placeholder": "",
"propertyName": "hide_version_info",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false,
"dependsOn": "",
"subformOptions": null
}
]
}