[release-12.0.3] CloudMigrations: Skip default contact point from snapshot (#106886)
CloudMigrations: Skip default contact point from snapshot (#106600)
* CloudMigrations: Skip default contact point from snapshot
* Update cloud-migration-assistant.md
* Update cloud-migration-assistant.md
---------
(cherry picked from commit a65743e41d)
Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
This commit is contained in:
co-authored by
Matheus Macabu
Jacob Valdez
parent
2dc0628b3d
commit
a4b56e7583
@@ -92,6 +92,12 @@ func (s *Service) getContactPoints(ctx context.Context, signedInUser *user.Signe
|
||||
contactPoints := make([]contactPoint, 0, len(embeddedContactPoints))
|
||||
|
||||
for _, embeddedContactPoint := range embeddedContactPoints {
|
||||
// This happens in the default contact point, and would otherwise fail to migrate because it has no UID.
|
||||
// If that contact point is edited in any way, an UID is generated.
|
||||
if embeddedContactPoint.UID == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
contactPoints = append(contactPoints, contactPoint{
|
||||
UID: embeddedContactPoint.UID,
|
||||
Name: embeddedContactPoint.Name,
|
||||
|
||||
@@ -89,14 +89,12 @@ func TestGetContactPoints(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
defaultEmailContactPointCount := 1
|
||||
|
||||
createdContactPoints := createContactPoints(t, ctx, s, user)
|
||||
|
||||
contactPoints, err := s.getContactPoints(ctx, user)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, contactPoints)
|
||||
require.Len(t, contactPoints, len(createdContactPoints)+defaultEmailContactPointCount)
|
||||
require.Len(t, contactPoints, len(createdContactPoints))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user