From e4a7c2c5b9988275f6c4aaa15cce0883faf837bf Mon Sep 17 00:00:00 2001 From: kmetin Date: Fri, 3 Nov 2023 11:19:49 +0300 Subject: [PATCH] fix Yuce's PR comments --- base/commands/migration/estimate.go | 6 ++---- base/commands/migration/estimate_it_test.go | 12 +++++------- base/commands/migration/start_stages_it_test.go | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/base/commands/migration/estimate.go b/base/commands/migration/estimate.go index 72e2d932..bb40d47f 100644 --- a/base/commands/migration/estimate.go +++ b/base/commands/migration/estimate.go @@ -24,11 +24,9 @@ func (e EstimateCmd) Init(cc plug.InitContext) error { func (e EstimateCmd) Exec(ctx context.Context, ec plug.ExecContext) error { ec.PrintlnUnnecessary("") - ec.PrintlnUnnecessary(`Hazelcast Data Migration Tool v5.3.0 -(c) 2023 Hazelcast, Inc. + ec.PrintlnUnnecessary(fmt.Sprintf(`%s -Estimation usually ends within 15 seconds. -`) +Estimation usually ends within 15 seconds.`, banner)) mID := MakeMigrationID() stages, err := NewEstimateStages(ec.Logger(), mID, ec.GetStringArg(argDMTConfig)) if err != nil { diff --git a/base/commands/migration/estimate_it_test.go b/base/commands/migration/estimate_it_test.go index e9c1cc78..b21da4fc 100644 --- a/base/commands/migration/estimate_it_test.go +++ b/base/commands/migration/estimate_it_test.go @@ -25,30 +25,28 @@ func TestEstimate(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - check.Must(tcx.CLC().Execute(ctx, "estimate", "dmt-config")) + check.Must(tcx.CLC().Execute(ctx, "estimate", "testdata/dmt-config")) }() c := make(chan string) go findEstimationID(ctx, tcx, c) mID := <-c - go estimateRunner(t, ctx, tcx, mID) + go estimateRunner(ctx, tcx, mID) wg.Wait() tcx.AssertStdoutContains("OK Estimation completed successfully") }) } -func estimateRunner(t *testing.T, ctx context.Context, tcx it.TestContext, migrationID string) { +func estimateRunner(ctx context.Context, tcx it.TestContext, migrationID string) { statusMap := check.MustValue(tcx.Client.GetMap(ctx, migration.StatusMapName)) b := check.MustValue(os.ReadFile("testdata/estimate/estimate_completed.json")) - it.Eventually(t, func() bool { - return statusMap.Set(ctx, migrationID, serialization.JSON(b)) == nil - }) + check.Must(statusMap.Set(ctx, migrationID, serialization.JSON(b))) } func findEstimationID(ctx context.Context, tcx it.TestContext, c chan string) { q := check.MustValue(tcx.Client.GetQueue(ctx, migration.EstimateQueueName)) var b migration.ConfigBundle for { - v := check.MustValue(q.PollWithTimeout(ctx, time.Second)) + v := check.MustValue(q.PollWithTimeout(ctx, 100*time.Millisecond)) if v != nil { check.Must(json.Unmarshal(v.(serialization.JSON), &b)) c <- b.MigrationID diff --git a/base/commands/migration/start_stages_it_test.go b/base/commands/migration/start_stages_it_test.go index d3b6ac7c..a1634de4 100644 --- a/base/commands/migration/start_stages_it_test.go +++ b/base/commands/migration/start_stages_it_test.go @@ -67,7 +67,7 @@ func startMigrationTest(t *testing.T, expectedErr error, statusMapStateFiles []s var execErr error go tcx.WithReset(func() { defer wg.Done() - execErr = tcx.CLC().Execute(ctx, "start", "dmt-config", "--yes", "-o", outDir) + execErr = tcx.CLC().Execute(ctx, "start", "testdata/dmt-config", "--yes", "-o", outDir) }) c := make(chan string) go findMigrationID(ctx, tcx, c)