CloudMigrations: Store encryption key in unified secrets table (#90908)
* store encryption key in unified secrets table * fix local dev mode * make metadata more realistic * fix tests * fix sql queries against postgres * fix stats endpoint
This commit is contained in:
@@ -445,6 +445,7 @@ func (cma *CloudMigrationAPI) GetSnapshot(c *contextmodel.ReqContext) response.R
|
||||
dtoStats := SnapshotResourceStats{
|
||||
Types: make(map[MigrateDataType]int, len(snapshot.StatsRollup.CountsByStatus)),
|
||||
Statuses: make(map[ItemStatus]int, len(snapshot.StatsRollup.CountsByType)),
|
||||
Total: snapshot.StatsRollup.Total,
|
||||
}
|
||||
for s, c := range snapshot.StatsRollup.CountsByStatus {
|
||||
dtoStats.Statuses[ItemStatus(s)] = c
|
||||
|
||||
@@ -471,7 +471,7 @@ func TestCloudMigrationAPI_GetSnapshot(t *testing.T) {
|
||||
requestUrl: "/api/cloudmigration/migration/1234/snapshot/1",
|
||||
basicRole: org.RoleAdmin,
|
||||
expectedHttpResult: http.StatusOK,
|
||||
expectedBody: `{"uid":"fake_uid","status":"CREATING","sessionUid":"1234","created":"0001-01-01T00:00:00Z","finished":"0001-01-01T00:00:00Z","results":[],"stats":{"types":{},"statuses":{}}}`,
|
||||
expectedBody: `{"uid":"fake_uid","status":"CREATING","sessionUid":"1234","created":"0001-01-01T00:00:00Z","finished":"0001-01-01T00:00:00Z","results":[],"stats":{"types":{},"statuses":{},"total":0}}`,
|
||||
},
|
||||
{
|
||||
desc: "should return 403 if no used is not admin",
|
||||
|
||||
@@ -307,6 +307,7 @@ type GetSnapshotResponseDTO struct {
|
||||
type SnapshotResourceStats struct {
|
||||
Types map[MigrateDataType]int `json:"types"`
|
||||
Statuses map[ItemStatus]int `json:"statuses"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// swagger:parameters getShapshotList
|
||||
|
||||
Reference in New Issue
Block a user