@@ -1295,7 +1295,12 @@ spec:
12951295
12961296 It ("HTTPRoute ResponseHeaderModifier" , func () {
12971297 By ("create HTTPRoute" )
1298- s .ApplyHTTPRoute (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin" }, respHeaderModifyByHeaders )
1298+ s .ApplyHTTPRoute (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin" }, respHeaderModifyByHeaders , func (_ context.Context ) (done bool , err error ) {
1299+ return s .NewAPISIXClient ().
1300+ GET ("/headers" ).
1301+ WithHost ("httpbin.example" ).
1302+ Expect ().Raw ().StatusCode == http .StatusOK , nil
1303+ })
12991304
13001305 By ("access dataplane to check the HTTPRoute" )
13011306 respExp := s .NewAPISIXClient ().
@@ -1456,7 +1461,11 @@ spec:
14561461 By ("create HTTPRoute" )
14571462 err := s .CreateResourceFromString (echoPlugin )
14581463 Expect (err ).NotTo (HaveOccurred (), "creating PluginConfig" )
1459- s .ApplyHTTPRoute (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin" }, extensionRefEchoPlugin )
1464+ s .ApplyHTTPRoute (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin" }, extensionRefEchoPlugin , func (_ context.Context ) (done bool , err error ) {
1465+ return s .NewAPISIXClient ().GET ("/get" ).
1466+ WithHeader ("Host" , "httpbin.example" ).
1467+ Expect ().Raw ().StatusCode == http .StatusOK , nil
1468+ })
14601469
14611470 s .NewAPISIXClient ().GET ("/get" ).
14621471 WithHeader ("Host" , "httpbin.example" ).
@@ -1466,13 +1475,11 @@ spec:
14661475
14671476 err = s .CreateResourceFromString (echoPluginUpdated )
14681477 Expect (err ).NotTo (HaveOccurred (), "updating PluginConfig" )
1469- time .Sleep (5 * time .Second )
1470-
1471- s .NewAPISIXClient ().GET ("/get" ).
1472- WithHeader ("Host" , "httpbin.example" ).
1473- Expect ().
1474- Body ().
1475- Contains ("Updated" )
1478+ Eventually (func () string {
1479+ return s .NewAPISIXClient ().GET ("/get" ).
1480+ WithHeader ("Host" , "httpbin.example" ).
1481+ Expect ().Body ().Raw ()
1482+ }).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (ContainSubstring ("Updated" ))
14761483 })
14771484 })
14781485
0 commit comments