@@ -25,6 +25,7 @@ import (
2525 . "github.com/onsi/ginkgo/v2"
2626 . "github.com/onsi/gomega"
2727 "k8s.io/apimachinery/pkg/types"
28+ "sigs.k8s.io/yaml"
2829
2930 apiv2 "github.com/apache/apisix-ingress-controller/api/v2"
3031 "github.com/apache/apisix-ingress-controller/test/e2e/framework"
@@ -186,6 +187,32 @@ spec:
186187 By ("check route in APISIX" )
187188 assertion (getRequest ("/get" )).Should (Equal (200 ), "should be able to access the route" )
188189 })
190+
191+ It ("update the same status only once" , func () {
192+ By ("apply ApisixRoute" )
193+ applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "default" }, & apiv2.ApisixRoute {}, ar )
194+
195+ output , _ := s .GetOutputFromString ("ar" , "default" , "-o" , "yaml" )
196+
197+ var route apiv2.ApisixRoute
198+ err := yaml .Unmarshal ([]byte (output ), & route )
199+ Expect (err ).NotTo (HaveOccurred (), "unmarshalling ApisixRoute" )
200+
201+ assertion (route .Status .Conditions ).Should (HaveLen (1 ), "should have one condition" )
202+
203+ s .Deployer .ScaleIngress (0 )
204+ s .Deployer .ScaleIngress (1 )
205+
206+ output , _ = s .GetOutputFromString ("ar" , "default" , "-o" , "yaml" )
207+
208+ var route2 apiv2.ApisixRoute
209+ err = yaml .Unmarshal ([]byte (output ), & route2 )
210+ Expect (err ).NotTo (HaveOccurred (), "unmarshalling ApisixRoute" )
211+
212+ assertion (route2 .Status .Conditions ).Should (HaveLen (1 ), "should have one condition" )
213+ Expect (route2 .Status .Conditions [0 ].LastTransitionTime ).To (Equal (route .Status .Conditions [0 ].LastTransitionTime ),
214+ "should not update the same status condition again" )
215+ })
189216 })
190217
191218 Context ("Test HTTPRoute Sync Status" , func () {
0 commit comments