Skip to content

Commit

Permalink
revert changes that fails start tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kutluhanmetin committed Nov 3, 2023
1 parent ab133ba commit f4f41b6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions base/commands/migration/start_stages_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ package migration_test

import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"sync"
"testing"
"time"

hz "github.com/hazelcast/hazelcast-go-client"
"github.com/hazelcast/hazelcast-go-client/serialization"
Expand Down Expand Up @@ -55,8 +57,6 @@ func startMigrationTest(t *testing.T, expectedErr error, statusMapStateFiles []s
tcx := it.TestContext{T: t}
ctx := context.Background()
tcx.Tester(func(tcx it.TestContext) {
migration.MigrationIDGeneratorFunc = migrationIDFunc
mID := migrationIDFunc()
ci := hz.NewClientInternal(tcx.Client)
createMapping(ctx, tcx)
createMemberLogs(t, ctx, ci)
Expand All @@ -69,6 +69,9 @@ func startMigrationTest(t *testing.T, expectedErr error, statusMapStateFiles []s
defer wg.Done()
execErr = tcx.CLC().Execute(ctx, "start", "dmt-config", "--yes", "-o", outDir)
})
c := make(chan string)
go findMigrationID(ctx, tcx, c)
mID := <-c
wg.Add(1)
go migrationRunner(t, ctx, tcx, mID, &wg, statusMapStateFiles)
wg.Wait()
Expand Down Expand Up @@ -110,3 +113,16 @@ func createMapping(ctx context.Context, tcx it.TestContext) {
func migrationIDFunc() string {
return "e6e928d3-63af-4e72-8c42-0bfcf0ab6cf7"
}

func findMigrationID(ctx context.Context, tcx it.TestContext, c chan string) {
q := MustValue(tcx.Client.GetQueue(ctx, migration.StartQueueName))
var b migration.ConfigBundle
for {
v := MustValue(q.PollWithTimeout(ctx, time.Second))
if v != nil {
Must(json.Unmarshal(v.(serialization.JSON), &b))
c <- b.MigrationID
break
}
}
}

0 comments on commit f4f41b6

Please sign in to comment.