Cloud migrations: store snapshots in the database (#108551)
* Cloud migrations: store snapshots in the database * update github.com/grafana/grafana-cloud-migration-snapshot to v1.9.0 * make update-workspace * use new field name in test * return error after call to fmt.Errorf * create methods for readability / fix session deletiong not deleting snapshots * remove debugging changes * update sample.ini * update tests to include OrgID in ListSnapshotsQuery * lint * lint * Update pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt.go Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> * remove TODO * Update pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt.go Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com> * remove one of the debug logs --------- Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
This commit is contained in:
@@ -103,14 +103,15 @@ func Test_GetSnapshotStatusFromGMS(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
uid, err := s.store.CreateSnapshot(ctx, cloudmigration.CloudMigrationSnapshot{
|
||||
UID: "test uid",
|
||||
uid := "test uid"
|
||||
|
||||
err = s.store.CreateSnapshot(ctx, cloudmigration.CloudMigrationSnapshot{
|
||||
UID: uid,
|
||||
SessionUID: sess.UID,
|
||||
Status: cloudmigration.SnapshotStatusCreating,
|
||||
GMSSnapshotUID: "gms uid",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "test uid", uid)
|
||||
|
||||
// Make sure status is coming from the db only
|
||||
snapshot, err := s.GetSnapshot(ctx, cloudmigration.GetSnapshotsQuery{
|
||||
@@ -381,8 +382,9 @@ func Test_OnlyQueriesStatusFromGMSWhenRequired(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
uid, err := s.store.CreateSnapshot(context.Background(), cloudmigration.CloudMigrationSnapshot{
|
||||
UID: uuid.NewString(),
|
||||
uid := uuid.NewString()
|
||||
err = s.store.CreateSnapshot(context.Background(), cloudmigration.CloudMigrationSnapshot{
|
||||
UID: uid,
|
||||
SessionUID: sess.UID,
|
||||
Status: cloudmigration.SnapshotStatusCreating,
|
||||
GMSSnapshotUID: "gms uid",
|
||||
|
||||
Reference in New Issue
Block a user