Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kutluhanmetin committed Nov 6, 2023
1 parent 1cd2f8c commit 527e73c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion base/commands/migration/estimate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"fmt"

"github.com/hazelcast/hazelcast-commandline-client/clc/paths"
"github.com/hazelcast/hazelcast-commandline-client/clc/ux/stage"
"github.com/hazelcast/hazelcast-commandline-client/internal/check"
"github.com/hazelcast/hazelcast-commandline-client/internal/plug"
Expand All @@ -27,8 +28,12 @@ func (e EstimateCmd) Exec(ctx context.Context, ec plug.ExecContext) error {
ec.PrintlnUnnecessary(fmt.Sprintf(`%s
Estimation usually ends within 15 seconds.`, banner))
conf := ec.GetStringArg(argDMTConfig)
if !paths.Exists(conf) {
return fmt.Errorf("migration config does not exist: %s", conf)
}
mID := MakeMigrationID()
stages, err := NewEstimateStages(ec.Logger(), mID, ec.GetStringArg(argDMTConfig))
stages, err := NewEstimateStages(ec.Logger(), mID, conf)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion base/commands/migration/estimate_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestEstimate(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
check.Must(tcx.CLC().Execute(ctx, "estimate", "testdata/dmt-config"))
check.Must(tcx.CLC().Execute(ctx, "estimate", "testdata/dmt_config"))
}()
c := make(chan string)
go findEstimationID(ctx, tcx, c)
Expand Down
8 changes: 7 additions & 1 deletion base/commands/migration/migration_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package migration

import (
"context"
"fmt"

"github.com/hazelcast/hazelcast-commandline-client/clc"
"github.com/hazelcast/hazelcast-commandline-client/clc/paths"
"github.com/hazelcast/hazelcast-commandline-client/clc/ux/stage"
clcerrors "github.com/hazelcast/hazelcast-commandline-client/errors"
"github.com/hazelcast/hazelcast-commandline-client/internal/check"
Expand Down Expand Up @@ -41,6 +43,10 @@ func (StartCmd) Exec(ctx context.Context, ec plug.ExecContext) (err error) {
Selected data structures in the source cluster will be migrated to the target cluster.
`)
conf := ec.GetStringArg(argDMTConfig)
if !paths.Exists(conf) {
return fmt.Errorf("migration config does not exist: %s", conf)
}
if !ec.Props().GetBool(clc.FlagAutoYes) {
p := prompt.New(ec.Stdin(), ec.Stdout())
yes, err := p.YesNo("Proceed?")
Expand All @@ -59,7 +65,7 @@ Selected data structures in the source cluster will be migrated to the target cl
err = finalizeErr
}
}()
sts, err := NewStartStages(ec.Logger(), mID, ec.GetStringArg(argDMTConfig))
sts, err := NewStartStages(ec.Logger(), mID, conf)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion base/commands/migration/start_stages_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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", "testdata/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)
Expand Down

0 comments on commit 527e73c

Please sign in to comment.