From f72fd85247f760baa99902134d48b0f72fea41e9 Mon Sep 17 00:00:00 2001 From: PJ Date: Thu, 12 Sep 2024 12:22:22 +0200 Subject: [PATCH] testing: fix TestMigrations --- internal/test/e2e/migrations_test.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/internal/test/e2e/migrations_test.go b/internal/test/e2e/migrations_test.go index b049da9083..3d3130bdc4 100644 --- a/internal/test/e2e/migrations_test.go +++ b/internal/test/e2e/migrations_test.go @@ -3,6 +3,7 @@ package e2e import ( "bytes" "context" + "encoding/json" "errors" "fmt" "reflect" @@ -137,19 +138,11 @@ func TestMigrations(t *testing.T) { ress, err := b.Alerts(context.Background(), alerts.AlertsOpts{}) tt.OK(err) for _, alert := range ress.Alerts { - // skip if not a migration alert - data, ok := alert.Data["objectIDs"].(map[string]interface{}) - if !ok { - continue - } - - // collect all object ids per bucket - for bucket, ids := range data { - if objectIDs, ok := ids.([]interface{}); ok { - for _, id := range objectIDs { - got[bucket] = append(got[bucket], id.(string)) - } - } + var objects []api.ObjectMetadata + b, _ := json.Marshal(alert.Data["objects"]) + json.Unmarshal(b, &objects) + for _, object := range objects { + got[object.Bucket] = append(got[object.Bucket], object.Name) } } if len(got) != 2 {