@@ -5424,6 +5424,68 @@ def test_set_up_sku(self):
54245424 )
54255425 self .assertEqual (dec_mc_2 , expect_mc_2 )
54265426
5427+ def test_set_up_node_provisioning_profile (self ):
5428+ dec_0 = AKSPreviewManagedClusterCreateDecorator (
5429+ self .cmd ,
5430+ self .client ,
5431+ {},
5432+ CUSTOM_MGMT_AKS_PREVIEW ,
5433+ )
5434+ # Not specified case
5435+ mc_0 = self .models .ManagedCluster (location = "test_location" )
5436+ dec_0 .context .attach_mc (mc_0 )
5437+ dec_mc_0 = dec_0 .set_up_node_provisioning_profile (mc_0 )
5438+ ground_truth_mc_0 = self .models .ManagedCluster (location = "test_location" )
5439+ self .assertEqual (dec_mc_0 , ground_truth_mc_0 )
5440+
5441+ # Set Mode to Auto
5442+ dec_1 = AKSPreviewManagedClusterCreateDecorator (
5443+ self .cmd ,
5444+ self .client ,
5445+ {
5446+ "node_provisioning_mode" : "Auto" ,
5447+ },
5448+ CUSTOM_MGMT_AKS_PREVIEW ,
5449+ )
5450+ mc_1 = self .models .ManagedCluster (
5451+ location = "test_location" ,
5452+ )
5453+ dec_1 .context .attach_mc (mc_1 )
5454+ dec_mc_1 = dec_1 .set_up_node_provisioning_profile (mc_1 )
5455+ ground_truth_mc_1 = self .models .ManagedCluster (
5456+ location = "test_location" ,
5457+ node_provisioning_profile = self .models .ManagedClusterNodeProvisioningProfile (
5458+ mode = "Auto" ,
5459+ ),
5460+ )
5461+ self .assertEqual (dec_mc_1 , ground_truth_mc_1 )
5462+
5463+ # Set Mode to Auto and DefaultPools to None
5464+ dec_2 = AKSPreviewManagedClusterCreateDecorator (
5465+ self .cmd ,
5466+ self .client ,
5467+ {
5468+ "node_provisioning_mode" : "Auto" ,
5469+ "node_provisioning_default_pools" : "None" ,
5470+
5471+ },
5472+ CUSTOM_MGMT_AKS_PREVIEW ,
5473+ )
5474+ mc_2 = self .models .ManagedCluster (
5475+ location = "test_location" ,
5476+ )
5477+ dec_2 .context .attach_mc (mc_2 )
5478+ dec_mc_2 = dec_2 .set_up_node_provisioning_profile (mc_2 )
5479+ ground_truth_mc_2 = self .models .ManagedCluster (
5480+ location = "test_location" ,
5481+ node_provisioning_profile = self .models .ManagedClusterNodeProvisioningProfile (
5482+ mode = "Auto" ,
5483+ default_node_pools = "None" ,
5484+ ),
5485+ )
5486+ self .assertEqual (dec_mc_2 , ground_truth_mc_2 )
5487+
5488+
54275489class AKSPreviewManagedClusterUpdateDecoratorTestCase (unittest .TestCase ):
54285490 def setUp (self ):
54295491 # manually register CUSTOM_MGMT_AKS_PREVIEW
@@ -9213,5 +9275,66 @@ def test_enable_retina_network_flow_logs(self):
92139275 ):
92149276 dec_6 .set_up_addon_profiles (mc_6 )
92159277
9278+ def test_update_node_provisioning_profile (self ):
9279+ dec_0 = AKSPreviewManagedClusterUpdateDecorator (
9280+ self .cmd ,
9281+ self .client ,
9282+ {},
9283+ CUSTOM_MGMT_AKS_PREVIEW ,
9284+ )
9285+ # Not specified case
9286+ mc_0 = self .models .ManagedCluster (location = "test_location" )
9287+ dec_0 .context .attach_mc (mc_0 )
9288+ dec_mc_0 = dec_0 .update_node_provisioning_profile (mc_0 )
9289+ ground_truth_mc_0 = self .models .ManagedCluster (location = "test_location" )
9290+ self .assertEqual (dec_mc_0 , ground_truth_mc_0 )
9291+
9292+ # Set Mode to Auto
9293+ dec_1 = AKSPreviewManagedClusterUpdateDecorator (
9294+ self .cmd ,
9295+ self .client ,
9296+ {
9297+ "node_provisioning_mode" : "Auto" ,
9298+ },
9299+ CUSTOM_MGMT_AKS_PREVIEW ,
9300+ )
9301+ mc_1 = self .models .ManagedCluster (
9302+ location = "test_location" ,
9303+ )
9304+ dec_1 .context .attach_mc (mc_1 )
9305+ dec_mc_1 = dec_1 .update_node_provisioning_profile (mc_1 )
9306+ ground_truth_mc_1 = self .models .ManagedCluster (
9307+ location = "test_location" ,
9308+ node_provisioning_profile = self .models .ManagedClusterNodeProvisioningProfile (
9309+ mode = "Auto" ,
9310+ ),
9311+ )
9312+ self .assertEqual (dec_mc_1 , ground_truth_mc_1 )
9313+
9314+ # Set Mode to Auto and DefaultPools to None
9315+ dec_2 = AKSPreviewManagedClusterUpdateDecorator (
9316+ self .cmd ,
9317+ self .client ,
9318+ {
9319+ "node_provisioning_mode" : "Auto" ,
9320+ "node_provisioning_default_pools" : "None" ,
9321+
9322+ },
9323+ CUSTOM_MGMT_AKS_PREVIEW ,
9324+ )
9325+ mc_2 = self .models .ManagedCluster (
9326+ location = "test_location" ,
9327+ )
9328+ dec_2 .context .attach_mc (mc_2 )
9329+ dec_mc_2 = dec_2 .update_node_provisioning_profile (mc_2 )
9330+ ground_truth_mc_2 = self .models .ManagedCluster (
9331+ location = "test_location" ,
9332+ node_provisioning_profile = self .models .ManagedClusterNodeProvisioningProfile (
9333+ mode = "Auto" ,
9334+ default_node_pools = "None" ,
9335+ ),
9336+ )
9337+ self .assertEqual (dec_mc_2 , ground_truth_mc_2 )
9338+
92169339if __name__ == "__main__" :
9217- unittest .main ()
9340+ unittest .main ()
0 commit comments