@@ -985,6 +985,91 @@ def test_enable_with_premiumv2_sku_and_azure_disk(self):
985985 )
986986 self .assertEqual (str (cm .exception ), err )
987987
988+ def test_enable_with_insufficient_cores_1 (self ):
989+ storage_pool_name = "valid-name"
990+ storage_pool_sku = acstor_consts .CONST_STORAGE_POOL_SKU_PREMIUM_LRS
991+ storage_pool_type = acstor_consts .CONST_STORAGE_POOL_TYPE_AZURE_DISK
992+ nodepool_list = "pool1"
993+ agentpools = [{"name" : "pool1" , "vm_size" : "Standard_D2s_v2" , "count" : 3 , "zoned" : False }]
994+ err = (
995+ "Cannot operate Azure Container Storage on a node pool consisting of "
996+ "nodes with cores less than 4. Node pool: pool1 with node size: Standard_D2s_v2 "
997+ "which is assigned for Azure Container Storage has nodes with 2 cores."
998+ )
999+ with self .assertRaises (InvalidArgumentValueError ) as cm :
1000+ acstor_validator .validate_enable_azure_container_storage_params (
1001+ storage_pool_type , storage_pool_name , storage_pool_sku , None , None , nodepool_list , agentpools , False , False , False , False , False , None , None , acstor_consts .CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY , acstor_consts .CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
1002+ )
1003+ self .assertEqual (str (cm .exception ), err )
1004+
1005+ def test_enable_with_insufficient_cores_2 (self ):
1006+ storage_pool_name = "valid-name"
1007+ storage_pool_sku = acstor_consts .CONST_STORAGE_POOL_SKU_PREMIUM_LRS
1008+ storage_pool_type = acstor_consts .CONST_STORAGE_POOL_TYPE_AZURE_DISK
1009+ nodepool_list = "pool1"
1010+ agentpools = [{"name" : "pool1" , "vm_size" : "Standard_H100-D2s_v2" , "count" : 3 , "zoned" : False }]
1011+ err = (
1012+ "Cannot operate Azure Container Storage on a node pool consisting of "
1013+ "nodes with cores less than 4. Node pool: pool1 with node size: Standard_H100-D2s_v2 "
1014+ "which is assigned for Azure Container Storage has nodes with 2 cores."
1015+ )
1016+ with self .assertRaises (InvalidArgumentValueError ) as cm :
1017+ acstor_validator .validate_enable_azure_container_storage_params (
1018+ storage_pool_type , storage_pool_name , storage_pool_sku , None , None , nodepool_list , agentpools , False , False , False , False , False , None , None , acstor_consts .CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY , acstor_consts .CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
1019+ )
1020+ self .assertEqual (str (cm .exception ), err )
1021+
1022+ def test_enable_with_insufficient_cores_3 (self ):
1023+ storage_pool_name = "valid-name"
1024+ storage_pool_sku = acstor_consts .CONST_STORAGE_POOL_SKU_PREMIUM_LRS
1025+ storage_pool_type = acstor_consts .CONST_STORAGE_POOL_TYPE_AZURE_DISK
1026+ nodepool_list = "pool1"
1027+ agentpools = [{"name" : "pool1" , "vm_size" : "Standard_H100-D2s" , "count" : 3 , "zoned" : False }]
1028+ err = (
1029+ "Cannot operate Azure Container Storage on a node pool consisting of "
1030+ "nodes with cores less than 4. Node pool: pool1 with node size: Standard_H100-D2s "
1031+ "which is assigned for Azure Container Storage has nodes with 2 cores."
1032+ )
1033+ with self .assertRaises (InvalidArgumentValueError ) as cm :
1034+ acstor_validator .validate_enable_azure_container_storage_params (
1035+ storage_pool_type , storage_pool_name , storage_pool_sku , None , None , nodepool_list , agentpools , False , False , False , False , False , None , None , acstor_consts .CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY , acstor_consts .CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
1036+ )
1037+ self .assertEqual (str (cm .exception ), err )
1038+
1039+ def test_enable_with_insufficient_cores_4 (self ):
1040+ storage_pool_name = "valid-name"
1041+ storage_pool_sku = acstor_consts .CONST_STORAGE_POOL_SKU_PREMIUM_LRS
1042+ storage_pool_type = acstor_consts .CONST_STORAGE_POOL_TYPE_AZURE_DISK
1043+ nodepool_list = "pool1"
1044+ agentpools = [{"name" : "pool1" , "vm_size" : "Standard_H2" , "count" : 3 , "zoned" : False }]
1045+ err = (
1046+ "Cannot operate Azure Container Storage on a node pool consisting of "
1047+ "nodes with cores less than 4. Node pool: pool1 with node size: Standard_H2 "
1048+ "which is assigned for Azure Container Storage has nodes with 2 cores."
1049+ )
1050+ with self .assertRaises (InvalidArgumentValueError ) as cm :
1051+ acstor_validator .validate_enable_azure_container_storage_params (
1052+ storage_pool_type , storage_pool_name , storage_pool_sku , None , None , nodepool_list , agentpools , False , False , False , False , False , None , None , acstor_consts .CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY , acstor_consts .CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
1053+ )
1054+ self .assertEqual (str (cm .exception ), err )
1055+
1056+ def test_enable_with_insufficient_cores_5 (self ):
1057+ storage_pool_name = "valid-name"
1058+ storage_pool_sku = acstor_consts .CONST_STORAGE_POOL_SKU_PREMIUM_LRS
1059+ storage_pool_type = acstor_consts .CONST_STORAGE_POOL_TYPE_AZURE_DISK
1060+ nodepool_list = "pool1"
1061+ agentpools = [{"name" : "pool1" , "vm_size" : "Standard_D2s" , "count" : 3 , "zoned" : False }]
1062+ err = (
1063+ "Cannot operate Azure Container Storage on a node pool consisting of "
1064+ "nodes with cores less than 4. Node pool: pool1 with node size: Standard_D2s "
1065+ "which is assigned for Azure Container Storage has nodes with 2 cores."
1066+ )
1067+ with self .assertRaises (InvalidArgumentValueError ) as cm :
1068+ acstor_validator .validate_enable_azure_container_storage_params (
1069+ storage_pool_type , storage_pool_name , storage_pool_sku , None , None , nodepool_list , agentpools , False , False , False , False , False , None , None , acstor_consts .CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY , acstor_consts .CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD
1070+ )
1071+ self .assertEqual (str (cm .exception ), err )
1072+
9881073 def test_enable_with_option_and_non_ephemeral_disk_pool (self ):
9891074 storage_pool_name = "valid-name"
9901075 storage_pool_option = acstor_consts .CONST_STORAGE_POOL_OPTION_NVME
0 commit comments