func CheckRegionInfo(c *check.C, output *api.RegionInfo, expected *core.RegionInfo) {
	region := api.NewRegionInfo(expected)
	output.Adjust()
	c.Assert(output, check.DeepEquals, region)
}
CheckRegionInfo is used to check the test results.
package pdctl
import (
	"bytes"
	"context"
	"fmt"
	"sort"
	"github.com/gogo/protobuf/proto"
	"github.com/pingcap/check"
	"github.com/pingcap/kvproto/pkg/metapb"
	"github.com/pingcap/kvproto/pkg/pdpb"
	"github.com/spf13/cobra"
	"github.com/tikv/pd/server"
	"github.com/tikv/pd/server/api"
	"github.com/tikv/pd/server/core"
	"github.com/tikv/pd/server/versioninfo"
	"github.com/tikv/pd/tests"
)
func ExecuteCommand(root *cobra.Command, args ...string) (output []byte, err error) {
	buf := new(bytes.Buffer)
	root.SetOutput(buf)
	root.SetArgs(args)
	err = root.Execute()
	return buf.Bytes(), err
}
func CheckStoresInfo(c *check.C, stores []*api.StoreInfo, want []*metapb.Store) {
	c.Assert(len(stores), check.Equals, len(want))
	mapWant := make(map[uint64]*metapb.Store)
	for _, s := range want {
		if _, ok := mapWant[s.Id]; !ok {
			mapWant[s.Id] = s
		}
	}
	for _, s := range stores {
		obtained := proto.Clone(s.Store.Store).(*metapb.Store)
		expected := proto.Clone(mapWant[obtained.Id]).(*metapb.Store)
		obtained.LastHeartbeat, expected.LastHeartbeat = 0, 0
		c.Assert(obtained, check.DeepEquals, expected)
	}
}