Skip to content

Commit 1d7b4b6

Browse files
wenhugWen Huang
authored andcommitted
test: add scenario test for VMSS nodepool VM size resize
Add a live scenario test that creates a cluster with Standard_D2s_v3 and resizes the nodepool to Standard_D4s_v3 via `az aks nodepool update --node-vm-size`, verifying the rolling upgrade completes successfully. Addresses reviewer request for scenario test coverage with custom header bypass for the AgentPoolVMSSResize feature flag. Signed-off-by: wenhug <50309350+wenhug@users.noreply.github.com>
1 parent 6739869 commit 1d7b4b6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23345,3 +23345,52 @@ def test_aks_list_vm_skus(self):
2334523345
(sku.get("locationInfo") or [{}])[0].get("zones") or []
2334623346
)
2334723347
assert len(zones) > 0, f"SKU '{sku['name']}' has no zones despite --zone filter"
23348+
23349+
@AllowLargeResponse()
23350+
@AKSCustomResourceGroupPreparer(
23351+
random_name_length=17, name_prefix="clitest", location="centraluseuap"
23352+
)
23353+
def test_aks_nodepool_update_vmss_vm_size_resize(
23354+
self, resource_group, resource_group_location
23355+
):
23356+
"""Test VMSS agent pool VM size resize via nodepool update (preview)."""
23357+
aks_name = self.create_random_name("cliakstest", 16)
23358+
nodepool_name = "nodepool1"
23359+
self.kwargs.update(
23360+
{
23361+
"resource_group": resource_group,
23362+
"name": aks_name,
23363+
"nodepool_name": nodepool_name,
23364+
"ssh_key_value": self.generate_ssh_keys(),
23365+
}
23366+
)
23367+
23368+
# Create cluster with Standard_D2s_v3
23369+
create_cmd = (
23370+
"aks create --resource-group={resource_group} --name={name} "
23371+
"--node-count=1 --node-vm-size Standard_D2s_v3 "
23372+
"--ssh-key-value={ssh_key_value} "
23373+
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AgentPoolVMSSResize"
23374+
)
23375+
self.cmd(
23376+
create_cmd,
23377+
checks=[
23378+
self.check("provisioningState", "Succeeded"),
23379+
self.check("agentPoolProfiles[0].vmSize", "Standard_D2s_v3"),
23380+
],
23381+
)
23382+
23383+
# Resize nodepool VM size to Standard_D4s_v3
23384+
update_cmd = (
23385+
"aks nodepool update --resource-group={resource_group} "
23386+
"--cluster-name={name} -n {nodepool_name} "
23387+
"--node-vm-size Standard_D4s_v3 "
23388+
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AgentPoolVMSSResize"
23389+
)
23390+
self.cmd(
23391+
update_cmd,
23392+
checks=[
23393+
self.check("provisioningState", "Succeeded"),
23394+
self.check("vmSize", "Standard_D4s_v3"),
23395+
],
23396+
)

0 commit comments

Comments
 (0)