diff --git a/internal/cli/dataimport/start/mysql.go b/internal/cli/dataimport/start/mysql.go index 479c7041..867b34d2 100644 --- a/internal/cli/dataimport/start/mysql.go +++ b/internal/cli/dataimport/start/mysql.go @@ -22,7 +22,6 @@ import ( "runtime" "strconv" "strings" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "time" "tidbcloud-cli/internal" @@ -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" diff --git a/internal/cli/dataimport/start/mysql_test.go b/internal/cli/dataimport/start/mysql_test.go index 07db4f32..9527a30a 100644 --- a/internal/cli/dataimport/start/mysql_test.go +++ b/internal/cli/dataimport/start/mysql_test.go @@ -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" @@ -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" @@ -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, }, @@ -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, }, @@ -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, },