@@ -56,76 +56,69 @@ class TestAksIsVmSkuAvailable(unittest.TestCase):
5656
5757 def test_no_restrictions_returns_true (self ):
5858 sku = _make_sku ("Standard_D4s_v3" , restrictions = [])
59- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
59+ self .assertTrue (_aks_is_vm_sku_available (sku ))
6060
6161 def test_none_restrictions_returns_true (self ):
6262 sku = _make_sku ("Standard_D4s_v3" )
6363 sku .restrictions = None
64- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
64+ self .assertTrue (_aks_is_vm_sku_available (sku ))
6565
6666 def test_irrelevant_reason_code_is_ignored (self ):
6767 # A restriction with a different reason_code should not affect availability.
6868 restriction = _make_restriction ("Location" , reason_code = "ManuallyExcluded" ,
6969 locations = ["eastus" ])
7070 sku = _make_sku ("Standard_D4s_v3" , location = "eastus" ,
7171 restrictions = [restriction ])
72- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
72+ self .assertTrue (_aks_is_vm_sku_available (sku ))
7373
7474 def test_location_restriction_matching_location_returns_false (self ):
7575 restriction = _make_restriction ("Location" , locations = ["eastus" ])
7676 sku = _make_sku ("Standard_D4s_v3" , location = "eastus" ,
7777 restrictions = [restriction ])
78- self .assertFalse (_aks_is_vm_sku_available (sku , zone = False ))
78+ self .assertFalse (_aks_is_vm_sku_available (sku ))
7979
8080 def test_location_restriction_non_matching_location_returns_true (self ):
8181 restriction = _make_restriction ("Location" , locations = ["westus" ])
8282 sku = _make_sku ("Standard_D4s_v3" , location = "eastus" ,
8383 restrictions = [restriction ])
84- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
84+ self .assertTrue (_aks_is_vm_sku_available (sku ))
8585
86- def test_zone_restriction_all_zones_restricted_with_zone_flag_returns_false (self ):
87- # All three zones are restricted and caller requests zone-aware filtering .
86+ def test_zone_restriction_all_zones_restricted_returns_false (self ):
87+ # All three zones are restricted — SKU is unavailable .
8888 restriction = _make_restriction ("Zone" , zones = ["1" , "2" , "3" ])
8989 sku = _make_sku ("Standard_D4s_v3" , zones = ["1" , "2" , "3" ],
9090 restrictions = [restriction ])
91- self .assertFalse (_aks_is_vm_sku_available (sku , zone = True ))
91+ self .assertFalse (_aks_is_vm_sku_available (sku ))
9292
9393 def test_zone_restriction_partial_zones_restricted_returns_true (self ):
9494 # Only zones 1 and 2 are restricted, but zone 3 is still available.
9595 restriction = _make_restriction ("Zone" , zones = ["1" , "2" ])
9696 sku = _make_sku ("Standard_D4s_v3" , zones = ["1" , "2" , "3" ],
9797 restrictions = [restriction ])
98- self .assertTrue (_aks_is_vm_sku_available (sku , zone = True ))
99-
100- def test_zone_restriction_ignored_when_zone_flag_false (self ):
101- # Even if all zones are restricted, without --zone the SKU is available.
102- restriction = _make_restriction ("Zone" , zones = ["1" , "2" , "3" ])
103- sku = _make_sku ("Standard_D4s_v3" , zones = ["1" , "2" , "3" ],
104- restrictions = [restriction ])
105- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
98+ self .assertTrue (_aks_is_vm_sku_available (sku ))
10699
107100 def test_location_restriction_with_empty_locations_list_returns_true (self ):
108101 # restriction_info.locations is present but empty – current region is not listed.
109102 restriction = _make_restriction ("Location" , locations = [])
110103 sku = _make_sku ("Standard_D4s_v3" , location = "eastus" ,
111104 restrictions = [restriction ])
112- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
105+ self .assertTrue (_aks_is_vm_sku_available (sku ))
113106
114107 def test_multiple_restrictions_one_location_match_returns_false (self ):
115108 # One restriction is unrelated; the second blocks the current location.
116109 r1 = _make_restriction ("Zone" , zones = ["1" ])
117110 r2 = _make_restriction ("Location" , locations = ["eastus" ])
118111 sku = _make_sku ("Standard_D4s_v3" , location = "eastus" ,
119112 zones = ["1" , "2" , "3" ], restrictions = [r1 , r2 ])
120- self .assertFalse (_aks_is_vm_sku_available (sku , zone = False ))
113+ self .assertFalse (_aks_is_vm_sku_available (sku ))
121114
122115 def test_none_restriction_info_is_handled_gracefully (self ):
123116 restriction = _make_restriction ("Location" , locations = ["eastus" ])
124117 restriction .restriction_info = None
125118 sku = _make_sku ("Standard_D4s_v3" , location = "eastus" ,
126119 restrictions = [restriction ])
127120 # With restriction_info=None the locations list defaults to [], so no match.
128- self .assertTrue (_aks_is_vm_sku_available (sku , zone = False ))
121+ self .assertTrue (_aks_is_vm_sku_available (sku ))
129122
130123
131124if __name__ == '__main__' :
0 commit comments