Skip to content

Commit 2b73124

Browse files
committed
retry for export cancel in client
1 parent f6b256e commit 2b73124

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sceneTest/export/export_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package export
33
import (
44
"context"
55
"io"
6+
"net/http"
67
"os"
78
"strings"
89
"testing"
@@ -401,8 +402,16 @@ func TestCancelExport(t *testing.T) {
401402
}
402403

403404
t.Log("start to cancel export")
404-
cancelRes, h, err := exportClient.ExportServiceAPI.ExportServiceCancelExport(ctx, clusterId, *res.ExportId).Execute()
405-
if util.ParseError(err, h) != nil {
405+
var cancelRes *export.Export
406+
var h *http.Response
407+
for i := 0; i < 3; i++ {
408+
cancelRes, h, err = exportClient.ExportServiceAPI.ExportServiceCancelExport(ctx, clusterId, *res.ExportId).Execute()
409+
if err == nil || !strings.Contains(err.Error(), "Internal Server Error") {
410+
break
411+
}
412+
time.Sleep(time.Millisecond * 10)
413+
}
414+
if err != nil {
406415
t.Fatal(util.ParseError(err, h))
407416
}
408417
assert.Equal(t, *cancelRes.State, export.EXPORTSTATEENUM_CANCELED)

0 commit comments

Comments
 (0)