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

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
pull/104081/head
Gilles De Mey 1 month ago committed by GitHub
parent 4e33702ea2
commit 71b06e9845
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      pkg/registry/apis/alerting/notifications/receiver/conversions.go
  2. 10
      pkg/tests/apis/alerting/notifications/receivers/receiver_test.go

@ -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{})

Loading…
Cancel
Save