@@ -1902,6 +1902,36 @@ var _ = Describe("IPAddressClaimReconciler", func() {
19021902 })
19031903 })
19041904
1905+ Context ("When the cluster can not be retrieved" , func () {
1906+ AfterEach (func () {
1907+ deleteClaim ("test" , namespace )
1908+ deleteNamespacedPool (poolName , namespace )
1909+ })
1910+ It ("When the cluster cannot be retrieved" , func () {
1911+ claim := ipamv1.IPAddressClaim {
1912+ ObjectMeta : metav1.ObjectMeta {
1913+ Name : "test" ,
1914+ Namespace : namespace ,
1915+ },
1916+ Spec : ipamv1.IPAddressClaimSpec {
1917+ ClusterName : clusterName ,
1918+ PoolRef : corev1.TypedLocalObjectReference {
1919+ APIGroup : ptr .To ("ipam.cluster.x-k8s.io" ),
1920+ Kind : "InClusterIPPool" ,
1921+ Name : poolName ,
1922+ },
1923+ },
1924+ }
1925+ Expect (k8sClient .Create (context .Background (), & claim )).To (Succeed ())
1926+ Eventually (Get (& claim )).Should (Succeed ())
1927+
1928+ addresses := ipamv1.IPAddressList {}
1929+ Consistently (ObjectList (& addresses , client .InNamespace (namespace ))).
1930+ WithTimeout (5 * time .Second ).WithPolling (100 * time .Millisecond ).Should (
1931+ HaveField ("Items" , HaveLen (0 )))
1932+ })
1933+ })
1934+
19051935 Context ("When the ipaddressclaim spec.clusterName reference a paused cluster via cluster label" , func () {
19061936 AfterEach (func () {
19071937 deleteClaim ("test" , namespace )
0 commit comments