-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 414 CLC-418 #417
Changes from 2 commits
87a802d
d5200a5
ecae8ab
12170b6
ac6a215
473b770
aa1aafa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,6 +188,14 @@ func WaitForMigrationToBeInProgress(ctx context.Context, ci *hazelcast.ClientInt | |
} | ||
return err | ||
} | ||
if Status(status) == StatusFailed { | ||
errs, err := fetchMigrationErrors(ctx, ci, migrationID) | ||
if err != nil { | ||
return fmt.Errorf("migration failed and dmt cannot fetch migration errors: %w", err) | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return errors.New(errs) | ||
} | ||
} | ||
if Status(status) == StatusInProgress { | ||
return nil | ||
} | ||
|
@@ -235,7 +243,7 @@ func fetchMigrationReport(ctx context.Context, ci *hazelcast.ClientInternal, mig | |
} | ||
|
||
func fetchMigrationErrors(ctx context.Context, ci *hazelcast.ClientInternal, migrationID string) (string, error) { | ||
q := fmt.Sprintf(`SELECT JSON_QUERY(this, '$.errors') FROM %s WHERE __key='%s'`, StatusMapName, migrationID) | ||
q := fmt.Sprintf(`SELECT JSON_QUERY(this, '$.errors' WITH WRAPPER) FROM %s WHERE __key='%s'`, StatusMapName, migrationID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
res, err := ci.Client().SQL().Execute(ctx, q) | ||
if err != nil { | ||
return "", err | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,16 @@ import ( | |
"testing" | ||
"time" | ||
|
||
hz "github.com/hazelcast/hazelcast-go-client" | ||
"github.com/hazelcast/hazelcast-go-client/serialization" | ||
"github.com/stretchr/testify/require" | ||
|
||
_ "github.com/hazelcast/hazelcast-commandline-client/base" | ||
_ "github.com/hazelcast/hazelcast-commandline-client/base/commands" | ||
"github.com/hazelcast/hazelcast-commandline-client/base/commands/migration" | ||
"github.com/hazelcast/hazelcast-commandline-client/clc/paths" | ||
. "github.com/hazelcast/hazelcast-commandline-client/internal/check" | ||
"github.com/hazelcast/hazelcast-commandline-client/internal/it" | ||
hz "github.com/hazelcast/hazelcast-go-client" | ||
"github.com/hazelcast/hazelcast-go-client/serialization" | ||
"github.com/stretchr/testify/require" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is done by goland automatically and I can't prevent it doing that :D |
||
) | ||
|
||
func TestMigrationStages(t *testing.T) { | ||
|
@@ -42,7 +43,7 @@ func TestMigrationStages(t *testing.T) { | |
"testdata/start/migration_success_initial.json", | ||
"testdata/start/migration_success_failure.json", | ||
}, | ||
expectedErr: errors.New("Failed migrating IMAP: imap5: some error"), | ||
expectedErr: errors.New("Failed migrating IMAP: imap5: [\"some error\"]"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this error message is not optimal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rewrite
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is possible to iterate |
||
}, | ||
} | ||
for _, tc := range testCases { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
else
is not necessary.