Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions internal/cmd/branch/vtctld/move_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,10 @@ func MoveTablesCancelCmd(ch *cmdutil.Helper) *cobra.Command {
cmd.Flags().StringVar(&flags.targetKeyspace, "target-keyspace", "", "Target keyspace")
cmd.Flags().BoolVar(&flags.keepData, "keep-data", false, "Keep the data in the target keyspace")
cmd.Flags().BoolVar(&flags.keepRoutingRules, "keep-routing-rules", false, "Keep the routing rules")
cmd.MarkFlagRequired("workflow") // nolint:errcheck
cmd.MarkFlagRequired("target-keyspace") // nolint:errcheck
cmd.MarkFlagRequired("workflow") // nolint:errcheck
cmd.MarkFlagRequired("target-keyspace") // nolint:errcheck
cmd.MarkFlagRequired("keep-data") // nolint:errcheck
cmd.MarkFlagRequired("keep-routing-rules") // nolint:errcheck

return cmd
}
Expand Down Expand Up @@ -524,8 +526,10 @@ func MoveTablesCompleteCmd(ch *cmdutil.Helper) *cobra.Command {
cmd.Flags().BoolVar(&flags.keepRoutingRules, "keep-routing-rules", false, "Keep the routing rules")
cmd.Flags().BoolVar(&flags.renameTables, "rename-tables", false, "Rename source tables instead of dropping them")
cmd.Flags().BoolVar(&flags.dryRun, "dry-run", false, "Only show what would be done")
cmd.MarkFlagRequired("workflow") // nolint:errcheck
cmd.MarkFlagRequired("target-keyspace") // nolint:errcheck
cmd.MarkFlagRequired("workflow") // nolint:errcheck
cmd.MarkFlagRequired("target-keyspace") // nolint:errcheck
cmd.MarkFlagRequired("keep-data") // nolint:errcheck
cmd.MarkFlagRequired("keep-routing-rules") // nolint:errcheck

return cmd
}
Expand Down
4 changes: 4 additions & 0 deletions internal/cmd/branch/vtctld/move_tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,12 +506,15 @@ func TestMoveTablesCancelWithFlags(t *testing.T) {
branch := "my-branch"

keepData := false
keepRoutingRules := false
svc := &mock.MoveTablesService{
CancelFn: func(ctx context.Context, req *ps.MoveTablesCancelRequest) (*ps.VtctldOperationReference, error) {
c.Assert(req.Workflow, qt.Equals, "my-workflow")
c.Assert(req.TargetKeyspace, qt.Equals, "target-ks")
c.Assert(req.KeepData, qt.IsNotNil)
c.Assert(*req.KeepData, qt.Equals, keepData)
c.Assert(req.KeepRoutingRules, qt.IsNotNil)
c.Assert(*req.KeepRoutingRules, qt.Equals, keepRoutingRules)
return &ps.VtctldOperationReference{ID: "cancel-op"}, nil
},
}
Expand Down Expand Up @@ -539,6 +542,7 @@ func TestMoveTablesCancelWithFlags(t *testing.T) {
"--workflow", "my-workflow",
"--target-keyspace", "target-ks",
"--keep-data=false",
"--keep-routing-rules=false",
})
err := cmd.Execute()
c.Assert(err, qt.IsNil)
Expand Down