@@ -287,23 +287,22 @@ var _ = framework.SerialDescribe("[group:bgp-speaker] BGP speaker", func() {
287287 }},
288288 },
289289 }
290- service , err := f .ClientSet . CoreV1 (). Services ( f . Namespace . Name ). Create ( context . TODO (), service , metav1. CreateOptions {} )
291- framework . ExpectNoError ( err )
292- ginkgo .DeferCleanup (func () { f . ServiceClient () .DeleteSync (serviceName ) })
290+ serviceClient := f .ServiceClient ( )
291+ service = serviceClient . Create ( service )
292+ ginkgo .DeferCleanup (func () { serviceClient .DeleteSync (serviceName ) })
293293 servicePrefix := ipv4Prefix (service .Spec .ClusterIP )
294294
295295 ginkgo .By ("Waiting for both speakers to advertise the ClusterIP" )
296296 waitForRouteNextHops (servicePrefix , controlPlaneNextHop , workerNextHop )
297297
298298 ginkgo .By ("Removing the BGP annotation while keeping the Service" )
299- service = service . DeepCopy ( )
300- delete ( service . Annotations , util . BgpAnnotation )
301- service , err = f . ClientSet . CoreV1 (). Services ( f . Namespace . Name ). Update ( context . TODO (), service , metav1. UpdateOptions {} )
302- framework . ExpectNoError ( err )
299+ original := serviceClient . Get ( serviceName )
300+ modified := original . DeepCopy ( )
301+ delete ( modified . Annotations , util . BgpAnnotation )
302+ service = serviceClient . Patch ( original , modified )
303303 waitForRouteWithdrawal (servicePrefix )
304304
305- current , err := f .ClientSet .CoreV1 ().Services (f .Namespace .Name ).Get (context .TODO (), serviceName , metav1.GetOptions {})
306- framework .ExpectNoError (err )
305+ current := serviceClient .Get (serviceName )
307306 gomega .Expect (current .Spec .ClusterIP ).To (gomega .Equal (service .Spec .ClusterIP ))
308307 })
309308})
0 commit comments