@@ -38,7 +38,6 @@ var _ = Describe("Whereabouts IP reconciler", func() {
3838 namespace = "default"
3939 networkName = "net1"
4040 podName = "pod1"
41- timeout = 10
4241 )
4342
4443 var (
@@ -75,16 +74,16 @@ var _ = Describe("Whereabouts IP reconciler", func() {
7574 Context ("reconciling the IPPool" , func () {
7675 BeforeEach (func () {
7776 var err error
78- reconcileLooper , err = NewReconcileLooperWithClient (context . TODO (), kubernetes .NewKubernetesClient (wbClient , k8sClientSet , timeout ), timeout )
77+ reconcileLooper , err = NewReconcileLooperWithClient (kubernetes .NewKubernetesClient (wbClient , k8sClientSet ) )
7978 Expect (err ).NotTo (HaveOccurred ())
8079 })
8180
8281 It ("should report the deleted IP reservation" , func () {
83- Expect (reconcileLooper .ReconcileIPPools (context . TODO () )).To (Equal ([]net.IP {net .ParseIP ("10.10.10.1" )}))
82+ Expect (reconcileLooper .ReconcileIPPools ()).To (Equal ([]net.IP {net .ParseIP ("10.10.10.1" )}))
8483 })
8584
8685 It ("the pool's orphaned IP should be deleted after the reconcile loop" , func () {
87- _ , err := reconcileLooper .ReconcileIPPools (context . TODO () )
86+ _ , err := reconcileLooper .ReconcileIPPools ()
8887 Expect (err ).NotTo (HaveOccurred ())
8988 poolAfterCleanup , err := wbClient .WhereaboutsV1alpha1 ().IPPools (namespace ).Get (context .TODO (), pool .GetName (), metav1.GetOptions {})
9089 Expect (err ).NotTo (HaveOccurred ())
@@ -139,18 +138,18 @@ var _ = Describe("Whereabouts IP reconciler", func() {
139138 Context ("reconciling the IPPool" , func () {
140139 BeforeEach (func () {
141140 var err error
142- reconcileLooper , err = NewReconcileLooperWithClient (context . TODO (), kubernetes .NewKubernetesClient (wbClient , k8sClientSet , timeout ), timeout )
141+ reconcileLooper , err = NewReconcileLooperWithClient (kubernetes .NewKubernetesClient (wbClient , k8sClientSet ) )
143142 Expect (err ).NotTo (HaveOccurred ())
144143 })
145144
146145 It ("should report the dead pod's IP address as deleted" , func () {
147- deletedIPAddrs , err := reconcileLooper .ReconcileIPPools (context . TODO () )
146+ deletedIPAddrs , err := reconcileLooper .ReconcileIPPools ()
148147 Expect (err ).NotTo (HaveOccurred ())
149148 Expect (deletedIPAddrs ).To (Equal ([]net.IP {net .ParseIP ("10.10.10.1" )}))
150149 })
151150
152151 It ("the IPPool should have only the IP reservation of the live pod" , func () {
153- deletedIPAddrs , err := reconcileLooper .ReconcileIPPools (context . TODO () )
152+ deletedIPAddrs , err := reconcileLooper .ReconcileIPPools ()
154153 Expect (err ).NotTo (HaveOccurred ())
155154 Expect (deletedIPAddrs ).NotTo (BeEmpty ())
156155
@@ -190,11 +189,11 @@ var _ = Describe("Whereabouts IP reconciler", func() {
190189
191190 By ("initializing the reconciler" )
192191 var err error
193- reconcileLooper , err = NewReconcileLooperWithClient (context . TODO (), kubernetes .NewKubernetesClient (wbClient , k8sClientSet , timeout ), timeout )
192+ reconcileLooper , err = NewReconcileLooperWithClient (kubernetes .NewKubernetesClient (wbClient , k8sClientSet ) )
194193 Expect (err ).NotTo (HaveOccurred ())
195194
196195 By ("reconciling and checking that the correct entry is deleted" )
197- deletedIPAddrs , err := reconcileLooper .ReconcileIPPools (context . TODO () )
196+ deletedIPAddrs , err := reconcileLooper .ReconcileIPPools ()
198197 Expect (err ).NotTo (HaveOccurred ())
199198 Expect (deletedIPAddrs ).To (Equal ([]net.IP {net .ParseIP ("10.10.10.2" )}))
200199
@@ -272,9 +271,9 @@ var _ = Describe("Whereabouts IP reconciler", func() {
272271
273272 It ("will delete an orphaned IP address" , func () {
274273 Expect (k8sClientSet .CoreV1 ().Pods (namespace ).Delete (context .TODO (), pods [podIndexToRemove ].Name , metav1.DeleteOptions {})).NotTo (HaveOccurred ())
275- newReconciler , err := NewReconcileLooperWithClient (context . TODO (), kubernetes .NewKubernetesClient (wbClient , k8sClientSet , timeout ), timeout )
274+ newReconciler , err := NewReconcileLooperWithClient (kubernetes .NewKubernetesClient (wbClient , k8sClientSet ) )
276275 Expect (err ).NotTo (HaveOccurred ())
277- Expect (newReconciler .ReconcileOverlappingIPAddresses (context . TODO () )).To (Succeed ())
276+ Expect (newReconciler .ReconcileOverlappingIPAddresses ()).To (Succeed ())
278277
279278 expectedClusterWideIPs := 2
280279 clusterWideIPAllocations , err := wbClient .WhereaboutsV1alpha1 ().OverlappingRangeIPReservations (namespace ).List (context .TODO (), metav1.ListOptions {})
@@ -338,9 +337,9 @@ var _ = Describe("Whereabouts IP reconciler", func() {
338337 })
339338
340339 It ("will not delete an IP address that isn't orphaned after running reconciler" , func () {
341- newReconciler , err := NewReconcileLooperWithClient (context . TODO (), kubernetes .NewKubernetesClient (wbClient , k8sClientSet , timeout ), timeout )
340+ newReconciler , err := NewReconcileLooperWithClient (kubernetes .NewKubernetesClient (wbClient , k8sClientSet ) )
342341 Expect (err ).NotTo (HaveOccurred ())
343- Expect (newReconciler .ReconcileOverlappingIPAddresses (context . TODO () )).To (Succeed ())
342+ Expect (newReconciler .ReconcileOverlappingIPAddresses ()).To (Succeed ())
344343
345344 expectedClusterWideIPs := 1
346345 clusterWideIPAllocations , err := wbClient .WhereaboutsV1alpha1 ().OverlappingRangeIPReservations (namespace ).List (context .TODO (), metav1.ListOptions {})
@@ -369,12 +368,12 @@ var _ = Describe("Whereabouts IP reconciler", func() {
369368
370369 pool = generateIPPoolSpec (ipRange , namespace , poolName , pod .Name )
371370 wbClient = fakewbclient .NewSimpleClientset (pool )
372- reconcileLooper , err = NewReconcileLooperWithClient (context . TODO (), kubernetes .NewKubernetesClient (wbClient , k8sClientSet , timeout ), timeout )
371+ reconcileLooper , err = NewReconcileLooperWithClient (kubernetes .NewKubernetesClient (wbClient , k8sClientSet ) )
373372 Expect (err ).NotTo (HaveOccurred ())
374373 })
375374
376375 It ("can be reconciled" , func () {
377- Expect (reconcileLooper .ReconcileIPPools (context . TODO () )).NotTo (BeEmpty ())
376+ Expect (reconcileLooper .ReconcileIPPools ()).NotTo (BeEmpty ())
378377 })
379378 })
380379})
@@ -410,7 +409,7 @@ var _ = Describe("IPReconciler", func() {
410409 })
411410
412411 It ("does not delete anything" , func () {
413- reconciledIPs , err := ipReconciler .ReconcileIPPools (context . TODO () )
412+ reconciledIPs , err := ipReconciler .ReconcileIPPools ()
414413 Expect (err ).NotTo (HaveOccurred ())
415414 Expect (reconciledIPs ).To (BeEmpty ())
416415 })
@@ -438,7 +437,7 @@ var _ = Describe("IPReconciler", func() {
438437 })
439438
440439 It ("does delete the orphaned IP address" , func () {
441- reconciledIPs , err := ipReconciler .ReconcileIPPools (context . TODO () )
440+ reconciledIPs , err := ipReconciler .ReconcileIPPools ()
442441 Expect (err ).NotTo (HaveOccurred ())
443442 Expect (reconciledIPs ).To (Equal ([]net.IP {net .ParseIP (firstIPInRange )}))
444443 })
@@ -458,7 +457,7 @@ var _ = Describe("IPReconciler", func() {
458457 })
459458
460459 It ("does delete *only the orphaned* the IP address" , func () {
461- reconciledIPs , err := ipReconciler .ReconcileIPPools (context . TODO () )
460+ reconciledIPs , err := ipReconciler .ReconcileIPPools ()
462461 Expect (err ).NotTo (HaveOccurred ())
463462 Expect (reconciledIPs ).To (ConsistOf ([]net.IP {net .ParseIP ("192.168.14.2" )}))
464463 })
0 commit comments