diff --git a/internal/cli/branch/delete.go b/internal/cli/branch/delete.go index 2212dc78..25844bd1 100644 --- a/internal/cli/branch/delete.go +++ b/internal/cli/branch/delete.go @@ -16,9 +16,6 @@ package branch import ( "fmt" - "strings" - "time" - "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" "tidbcloud-cli/internal/flag" @@ -149,27 +146,9 @@ func DeleteCmd(h *internal.Helper) *cobra.Command { if err != nil { return errors.Trace(err) } - - ticker := time.NewTicker(1 * time.Second) - defer ticker.Stop() - timer := time.After(2 * time.Minute) - for { - select { - case <-timer: - return errors.New("timeout waiting for deleting branch, please check status on dashboard") - case <-ticker.C: - _, err := d.GetBranch(branchApi.NewGetBranchParams(). - WithClusterID(clusterID). - WithBranchID(branchID)) - if err != nil { - if strings.Contains(err.Error(), "404") { - fmt.Fprintln(h.IOStreams.Out, color.GreenString("branch %s deleted", branchID)) - return nil - } - return errors.Trace(err) - } - } - } + // print success for delete branch is a sync operation + fmt.Fprintln(h.IOStreams.Out, color.GreenString("branch %s deleted", branchID)) + return nil }, } diff --git a/internal/cli/branch/delete_test.go b/internal/cli/branch/delete_test.go index f34185e9..79ee0c42 100644 --- a/internal/cli/branch/delete_test.go +++ b/internal/cli/branch/delete_test.go @@ -16,7 +16,6 @@ package branch import ( "bytes" - "errors" "fmt" "os" "testing" @@ -61,9 +60,6 @@ func (suite *DeleteBranchSuite) TestDeleteBranchArgs() { suite.mockClient.On("DeleteBranch", branchApi.NewDeleteBranchParams(). WithBranchID(branchID).WithClusterID(clusterID)). Return(&branchApi.DeleteBranchOK{}, nil) - suite.mockClient.On("GetBranch", branchApi.NewGetBranchParams(). - WithBranchID(branchID).WithClusterID(clusterID)). - Return(nil, errors.New("404")) tests := []struct { name string