Alerting: Return an empty array for contact points with no integrations (#104063)

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
This commit is contained in:
Gilles De Mey
2025-04-15 21:52:56 +01:00
committed by GitHub
co-authored by Matthew Jacobson
parent 4e33702ea2
commit 71b06e9845
2 changed files with 7 additions and 6 deletions
@@ -58,7 +58,8 @@ func convertToK8sResource(
namespacer request.NamespaceMapper,
) (*model.Receiver, error) {
spec := model.Spec{
Title: receiver.Name,
Title: receiver.Name,
Integrations: make([]model.Integration, 0, len(receiver.Integrations)),
}
for _, integration := range receiver.Integrations {
spec.Integrations = append(spec.Integrations, model.Integration{
@@ -75,7 +75,7 @@ func TestIntegrationResourceIdentifier(t *testing.T) {
},
Spec: v0alpha1.Spec{
Title: "Test-Receiver",
Integrations: nil,
Integrations: []v0alpha1.Integration{},
},
}
@@ -307,7 +307,7 @@ func TestIntegrationResourcePermissions(t *testing.T) {
},
Spec: v0alpha1.Spec{
Title: "receiver-1",
Integrations: nil,
Integrations: []v0alpha1.Integration{},
},
}
d, err := json.Marshal(created)
@@ -573,7 +573,7 @@ func TestIntegrationAccessControl(t *testing.T) {
},
Spec: v0alpha1.Spec{
Title: fmt.Sprintf("receiver-1-%s", tc.user.Identity.GetLogin()),
Integrations: nil,
Integrations: []v0alpha1.Integration{},
},
}
d, err := json.Marshal(expected)
@@ -929,7 +929,7 @@ func TestIntegrationOptimisticConcurrency(t *testing.T) {
},
Spec: v0alpha1.Spec{
Title: "receiver-1",
Integrations: nil,
Integrations: []v0alpha1.Integration{},
},
}
@@ -1271,7 +1271,7 @@ func TestIntegrationCRUD(t *testing.T) {
},
Spec: v0alpha1.Spec{
Title: defaultReceiver.Spec.Title,
Integrations: nil,
Integrations: []v0alpha1.Integration{},
},
}
_, err := adminClient.Create(ctx, newReceiver, v1.CreateOptions{})