-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add non-premium disk option for repair VM #8486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
5e7a5ac
7a5c280
95da1de
0ff1b81
b35c472
7d501ba
c312b9c
8a6d6a6
5d9ea0e
4513653
fcba2ed
c2f3712
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1179,3 +1179,62 @@ def test_vmrepair_WinRunRepairVMIdafterRefactor(self, resource_group): | |
|
||
# Call Restore | ||
self.cmd('vm repair restore -g {rg} -n {vm} --yes') | ||
|
||
@pytest.mark.NonPremiumOSDisk | ||
class WindowsNonPremiumOSDiskRepairVM(LiveScenarioTest): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May I ask why do we mark this test as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because these tests do not run against recorded json responses, they are live runs in Azure when I run them and create actual resources that are then cleaned up. That is what LiveScenarioTest does. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, why can't these tests be created as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zhoxing-ms They might be able to, but what is the benefit? I think PS has moved to Live Smoke tests these days anyway. Recorded json tests are an old framework. |
||
|
||
@ResourceGroupPreparer(location='westus2') | ||
def test_vmrepair_WinNonPremiumOSDiskRepairVM(self, resource_group): | ||
import uuid | ||
import secrets | ||
import string | ||
base_password = "Passw0rd2024" | ||
guid_suffix = str(uuid.uuid4()) | ||
secure_password = base_password + guid_suffix | ||
username_length = 8 | ||
secure_username = ''.join(secrets.choice(string.ascii_letters + string.digits) for _ in range(username_length)) | ||
stnd_os_disk_type = "StandardSSD_LRS" | ||
self.kwargs.update({ | ||
'vm': 'vm1', | ||
'admin_password': secure_password, | ||
'admin_username': secure_username, | ||
'stnd_os_disk_type': stnd_os_disk_type | ||
}) | ||
|
||
# Create test VM | ||
self.cmd('vm create -g {rg} -n {vm} --admin-username {admin_username} --admin-password {admin_password} --image MicrosoftWindowsServer:WindowsServer:2022-datacenter-g2:latest') | ||
vms = self.cmd('vm list -g {rg} -o json').get_output_in_json() | ||
# Something wrong with vm create command if it fails here | ||
assert len(vms) == 1 | ||
|
||
# Create Repair VM | ||
repair_vm = self.cmd('vm repair create -g {rg} -n {vm} --repair-username {admin_username} --repair-password {admin_password} --yes --os-disk-type {stnd_os_disk_type} -o json').get_output_in_json() | ||
assert repair_vm['status'] == STATUS_SUCCESS, repair_vm['error_message'] | ||
# Check repair VM | ||
self.kwargs.update({ | ||
'vm': 'vm1', | ||
'admin_password': secure_password, | ||
'admin_username': secure_username, | ||
'repair_resource_group': repair_vm['repair_resource_group'] | ||
}) | ||
repair_vms = self.cmd('vm list -g {repair_resource_group} -o json').get_output_in_json() | ||
assert len(repair_vms) == 1 | ||
repair_vm = repair_vms[0] | ||
repair_vm_id = repair_vm['id'] | ||
# Verify the image sku is the default sku | ||
os_disk_type = repair_vm['storageProfile']['osDisk']['managedDisk']['storageAccountType'] | ||
assert os_disk_type == stnd_os_disk_type, "Os Disk Storage Account Type is not the expected value." | ||
|
||
repair_vm_id = repair_vm['id'] | ||
self.kwargs.update({ | ||
'vm': 'vm1', | ||
'admin_password': secure_password, | ||
'admin_username': secure_username, | ||
'repair_vm_id': repair_vm_id | ||
}) | ||
# Run a script for testing repair-vm-id | ||
result_run = self.cmd('vm repair run -g {rg} -n {vm} --run-id win-hello-world --repair-vm-id {repair_vm_id} --run-on-repair -o json').get_output_in_json() | ||
assert result_run['status'] == STATUS_SUCCESS, result_run['error_message'] | ||
|
||
# Call Restore | ||
self.cmd('vm repair restore -g {rg} -n {vm} --yes') |
Uh oh!
There was an error while loading. Please reload this page.