Skip to content

Commit

Permalink
some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Dec 14, 2023
1 parent 73a091e commit ca534f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
3 changes: 1 addition & 2 deletions internal/cli/dataimport/start/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"runtime"
"strconv"
"strings"
serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service"
"time"

"tidbcloud-cli/internal"
Expand All @@ -32,10 +31,10 @@ import (
"tidbcloud-cli/internal/telemetry"
"tidbcloud-cli/internal/ui"
"tidbcloud-cli/internal/util"
serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service"

"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/terminal"

"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/fatih/color"
Expand Down
34 changes: 17 additions & 17 deletions internal/cli/dataimport/start/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"path/filepath"
"runtime"
"testing"
"tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service"
"tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models"

"tidbcloud-cli/internal"
"tidbcloud-cli/internal/config"
Expand All @@ -32,6 +30,8 @@ import (
"tidbcloud-cli/internal/service/cloud"
connectInfoService "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service"
connectInfoModel "tidbcloud-cli/pkg/tidbcloud/connect_info/models"
serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service"
serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models"

mockTool "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -198,11 +198,11 @@ func (suite *MySQLImportSuite) TestMySQLImportArgs() {
"-p" + password,
}
suite.mockHelper.On("ImportToServerless", mockTool.Anything, importArgs, cachePath).Return(nil)
suite.mockClient.On("GetCluster", serverless_service.NewServerlessServiceGetClusterParams().
WithClusterID(clusterID)).Return(&serverless_service.ServerlessServiceGetClusterOK{
Payload: &models.TidbCloudOpenApiserverlessv1beta1Cluster{
Endpoints: &models.V1beta1ClusterEndpoints{
PublicEndpoint: &models.EndpointsPublic{
suite.mockClient.On("GetCluster", serverlessApi.NewServerlessServiceGetClusterParams().
WithClusterID(clusterID)).Return(&serverlessApi.ServerlessServiceGetClusterOK{
Payload: &serverlessModel.TidbCloudOpenApiserverlessv1beta1Cluster{
Endpoints: &serverlessModel.V1beta1ClusterEndpoints{
PublicEndpoint: &serverlessModel.EndpointsPublic{
Host: targetHost,
Port: targetPort,
},
Expand Down Expand Up @@ -312,11 +312,11 @@ func (suite *MySQLImportSuite) TestMySQLImportWithoutCreateTable() {
"-p" + password,
}
suite.mockHelper.On("ImportToServerless", mockTool.Anything, importArgs, cachePath).Return(nil)
suite.mockClient.On("GetCluster", serverless_service.NewServerlessServiceGetClusterParams().
WithClusterID(clusterID)).Return(&serverless_service.ServerlessServiceGetClusterOK{
Payload: &models.TidbCloudOpenApiserverlessv1beta1Cluster{
Endpoints: &models.V1beta1ClusterEndpoints{
PublicEndpoint: &models.EndpointsPublic{
suite.mockClient.On("GetCluster", serverlessApi.NewServerlessServiceGetClusterParams().
WithClusterID(clusterID)).Return(&serverlessApi.ServerlessServiceGetClusterOK{
Payload: &serverlessModel.TidbCloudOpenApiserverlessv1beta1Cluster{
Endpoints: &serverlessModel.V1beta1ClusterEndpoints{
PublicEndpoint: &serverlessModel.EndpointsPublic{
Host: targetHost,
Port: targetPort,
},
Expand Down Expand Up @@ -421,11 +421,11 @@ func (suite *MySQLImportSuite) TestMySQLImportWithSpecificUser() {
"-p" + password,
}
suite.mockHelper.On("ImportToServerless", mockTool.Anything, importArgs, cachePath).Return(nil)
suite.mockClient.On("GetCluster", serverless_service.NewServerlessServiceGetClusterParams().
WithClusterID(clusterID)).Return(&serverless_service.ServerlessServiceGetClusterOK{
Payload: &models.TidbCloudOpenApiserverlessv1beta1Cluster{
Endpoints: &models.V1beta1ClusterEndpoints{
PublicEndpoint: &models.EndpointsPublic{
suite.mockClient.On("GetCluster", serverlessApi.NewServerlessServiceGetClusterParams().
WithClusterID(clusterID)).Return(&serverlessApi.ServerlessServiceGetClusterOK{
Payload: &serverlessModel.TidbCloudOpenApiserverlessv1beta1Cluster{
Endpoints: &serverlessModel.V1beta1ClusterEndpoints{
PublicEndpoint: &serverlessModel.EndpointsPublic{
Host: targetHost,
Port: targetPort,
},
Expand Down

0 comments on commit ca534f1

Please sign in to comment.