File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module mosn.io/htnn/e2e
17
17
go 1.21.5
18
18
19
19
require (
20
+ github.com/avast/retry-go v3.0.0+incompatible
20
21
github.com/stretchr/testify v1.9.0
21
22
istio.io/client-go v1.21.2
22
23
k8s.io/api v0.29.3
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRB
8
8
github.com/agnivade/levenshtein v1.1.1 /go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo =
9
9
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI =
10
10
github.com/antlr4-go/antlr/v4 v4.13.0 /go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g =
11
+ github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0 =
12
+ github.com/avast/retry-go v3.0.0+incompatible /go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY =
11
13
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM =
12
14
github.com/beorn7/perks v1.0.1 /go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw =
13
15
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs =
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
21
21
"testing"
22
22
"time"
23
23
24
+ "github.com/avast/retry-go"
24
25
"github.com/stretchr/testify/require"
25
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26
27
"k8s.io/apimachinery/pkg/runtime"
@@ -42,7 +43,20 @@ func init() {
42
43
suite .Register (suite.Test {
43
44
Manifests : []string {"base/httproute.yml" },
44
45
Run : func (t * testing.T , suite * suite.Suite ) {
45
- rsp , err := suite .Get ("/echo" , hdrWithKey ("rick" ))
46
+ var rsp * http.Response
47
+ var err error
48
+ err = retry .Do (
49
+ func () error {
50
+ rsp , err = suite .Get ("/echo" , hdrWithKey ("rick" ))
51
+ return err
52
+ },
53
+ retry .RetryIf (func (err error ) bool {
54
+ return true
55
+ }),
56
+ retry .Attempts (3 ),
57
+ // backoff delay
58
+ retry .Delay (500 * time .Millisecond ),
59
+ )
46
60
require .NoError (t , err )
47
61
require .Equal (t , 200 , rsp .StatusCode )
48
62
req , _ , err := suite .Capture (rsp )
You can’t perform that action at this time.
0 commit comments