@@ -776,7 +776,8 @@ def test_flush(self, flush):
776
776
6 , self .parent .name , self .addr_cmd ._parent .namespace )
777
777
778
778
def test_wait_until_address_ready (self ):
779
- self .addr_cmd .list = mock .Mock (return_value = [{'tentative' : False }])
779
+ self .addr_cmd .list = mock .Mock (
780
+ return_value = [{'tentative' : False , 'dadfailed' : False }])
780
781
# this address is not tentative or failed so it should return
781
782
self .assertIsNone (self .addr_cmd .wait_until_address_ready (
782
783
'2001:470:9:1224:fd91:272:581e:3a32' ))
@@ -786,6 +787,24 @@ def test_wait_until_address_ready_non_existent_address(self):
786
787
with testtools .ExpectedException (ip_lib .AddressNotReady ):
787
788
self .addr_cmd .wait_until_address_ready ('abcd::1234' )
788
789
790
+ def test_wait_until_address_dadfailed (self ):
791
+ self .addr_cmd .list = mock .Mock (
792
+ return_value = [{'tentative' : True , 'dadfailed' : True }])
793
+ with testtools .ExpectedException (ip_lib .AddressNotReady ):
794
+ self .addr_cmd .wait_until_address_ready ('abcd::1234' )
795
+
796
+ @mock .patch .object (common_utils , 'wait_until_true' )
797
+ def test_wait_until_address_ready_success_one_timeout (self , mock_wuntil ):
798
+ tentative_address = 'fe80::3023:39ff:febc:22ae'
799
+ self .addr_cmd .list = mock .Mock (return_value = [
800
+ dict (scope = 'link' , dadfailed = False , tentative = True , dynamic = False ,
801
+ cidr = tentative_address + '/64' ),
802
+ dict (scope = 'link' , dadfailed = False , tentative = False , dynamic = False ,
803
+ cidr = tentative_address + '/64' )])
804
+ self .assertIsNone (self .addr_cmd .wait_until_address_ready (
805
+ tentative_address , wait_time = 3 ))
806
+ self .assertEqual (1 , mock_wuntil .call_count )
807
+
789
808
def test_wait_until_address_ready_timeout (self ):
790
809
tentative_address = 'fe80::3023:39ff:febc:22ae'
791
810
self .addr_cmd .list = mock .Mock (return_value = [
0 commit comments