package pkg

import (
	"time"

	"github.com/pingcap/log"
	"github.com/pingcap/test-infra/sdk/resource"
	"go.uber.org/zap"
)

func ScaleCluster(tc resource.TiDBCluster, nodeTpye resource.TiDBCompType, num uint32) error {
	node := nodeTpye.String()
	log.Info("start scale cluster",
		zap.String("component", node),
		zap.Uint32("replicas", num))
	return tc.Scale(resource.TiDBClusterScaleOptions{
		Target:   nodeTpye,
		Replicas: num,
		Timeout:  time.Hour,
	})
}
