CloudMigration: Provide a stats rollup in the GetSnapshot response (#90252)

* order session list descending

* add snapshot status method to store

* query stats while retrieving snapshot

* return stats in dto

* swagger

* fix tests

* commit results of bingo get

* fix swagger

* minor improvement

* fix typo

* forgot a file
This commit is contained in:
Michael Mandrus
2024-07-10 08:46:38 -04:00
committed by GitHub
parent a3dfc894f7
commit 317da43a84
11 changed files with 190 additions and 25 deletions
@@ -25,7 +25,7 @@ func Test_GetAllCloudMigrationSessions(t *testing.T) {
ctx := context.Background()
t.Run("get all cloud_migration_session entries", func(t *testing.T) {
value, err := s.GetAllCloudMigrationSessions(ctx)
value, err := s.GetCloudMigrationSessionList(ctx)
require.NoError(t, err)
require.Equal(t, 3, len(value))
for _, m := range value {
@@ -245,6 +245,19 @@ func Test_SnapshotResources(t *testing.T) {
}
}
// check stats
stats, err := s.GetSnapshotResourceStats(ctx, "poiuy")
assert.NoError(t, err)
assert.Equal(t, map[cloudmigration.MigrateDataType]int{
cloudmigration.DatasourceDataType: 2,
cloudmigration.DashboardDataType: 1,
cloudmigration.FolderDataType: 1,
}, stats.CountsByType)
assert.Equal(t, map[cloudmigration.ItemStatus]int{
cloudmigration.ItemStatusOK: 3,
cloudmigration.ItemStatusPending: 1,
}, stats.CountsByStatus)
// delete snapshot resources
err = s.DeleteSnapshotResources(ctx, "poiuy")
assert.NoError(t, err)