Skip to content

Commit 087db12

Browse files
authored
Fix VM Repair tests failing for no good reason (Azure#7890)
* using different alias * fixed several tests * Update test_repair_commands.py, rename duplicate tests * Update HISTORY.rst * Update test_repair_commands.py, revert attempts at keyvault * Update repair_utils.py * undo sles15 stuff until new image is determined, fixed test though * image fixed * Update HISTORY.rst * Update HISTORY.rst * update image aliases * update param docs with reliable images * setup version
1 parent 18907bf commit 087db12

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed

src/vm-repair/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Release History
33
===============
44

5+
1.0.9
6+
++++++
7+
Fixed and updated several vm-repair tests for better coverage.
8+
Removed and updated broken image aliases pointing at images that no longer existed.
9+
510
1.0.8
611
++++++
712
SELFHELP telemetry added as initiator. Extra parameters is introduced at the backend to capture the telemetry data.

src/vm-repair/azext_vm_repair/_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def load_arguments(self, _):
3131
c.argument('unlock_encrypted_vm', help='Option to auto-unlock encrypted VMs using current subscription auth.')
3232
c.argument('enable_nested', help='enable nested hyperv.')
3333
c.argument('associate_public_ip', help='Option to create repair vm with public ip')
34-
c.argument('distro', help='Option to create repair vm from a specific linux distro (rhel7|rhel8|suse12|ubuntu20|centos7|oracle7)')
34+
c.argument('distro', help='Option to create repair vm from a specific linux distro (rhel7|rhel8|sles12|sles15|ubuntu20|centos7|centos8|oracle7)')
3535
c.argument('yes', help='Option to skip prompt for associating public ip and confirm yes to it in no Tty mode')
3636

3737
with self.argument_context('vm repair restore') as c:

src/vm-repair/azext_vm_repair/repair_utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ def _fetch_compatible_windows_os_urn(source_vm):
493493

494494
def _select_distro_linux(distro):
495495
image_lookup = {
496-
'rhel6': 'RedHat:RHEL:6.10:latest',
497496
'rhel7': 'RedHat:rhel-raw:7-raw:latest',
498497
'rhel8': 'RedHat:rhel-raw:8-raw:latest',
499498
'ubuntu18': 'Canonical:UbuntuServer:18.04-LTS:latest',
@@ -503,9 +502,8 @@ def _select_distro_linux(distro):
503502
'centos8': 'OpenLogic:CentOS:8_4:latest',
504503
'oracle6': 'Oracle:Oracle-Linux:6.10:latest',
505504
'oracle7': 'Oracle:Oracle-Linux:ol79:latest',
506-
'oracle8': 'Oracle:Oracle-Linux:ol82:latest',
507505
'sles12': 'SUSE:sles-12-sp5:gen1:latest',
508-
'sles15': 'SUSE:sles-15-sp3:gen1:latest',
506+
'sles15': 'SUSE:sles-15-sp6:gen1:latest',
509507
}
510508
if distro in image_lookup:
511509
os_image_urn = image_lookup[distro]
@@ -521,7 +519,7 @@ def _select_distro_linux(distro):
521519

522520
def _select_distro_linux_Arm64(distro):
523521
image_lookup = {
524-
'rhel8': 'RedHat:rhel-arm64:8_8-arm64:latest',
522+
'rhel8': 'RedHat:rhel-arm64:8_8-arm64-gen2:latest',
525523
'rhel9': 'RedHat:rhel-arm64:9_2-arm64:latest',
526524
'ubuntu18': 'Canonical:UbuntuServer:18_04-lts-arm64:latest',
527525
'ubuntu20': 'Canonical:0001-com-ubuntu-server-focal:20_04-lts-arm64:latest',
@@ -542,15 +540,12 @@ def _select_distro_linux_Arm64(distro):
542540
def _select_distro_linux_gen2(distro):
543541
# base on the document : https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2#generation-2-vm-images-in-azure-marketplace
544542
image_lookup = {
545-
'rhel6': 'RedHat:rhel-raw:7-raw-gen2:latest',
546543
'rhel7': 'RedHat:rhel-raw:7-raw-gen2:latest',
547544
'rhel8': 'RedHat:rhel-raw:8-raw-gen2:latest',
548545
'ubuntu18': 'Canonical:UbuntuServer:18_04-lts-gen2:latest',
549546
'ubuntu20': 'Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:latest',
550-
'centos6': 'OpenLogic:CentOS:7_9-gen2:latest',
551547
'centos7': 'OpenLogic:CentOS:7_9-gen2:latest',
552548
'centos8': 'OpenLogic:CentOS:8_4-gen2:latest',
553-
'oracle6': 'Oracle:Oracle-Linux:ol79-gen2:latest',
554549
'oracle7': 'Oracle:Oracle-Linux:ol79-gen2:latest',
555550
'oracle8': 'Oracle:Oracle-Linux:ol82-gen2:latest',
556551
'sles12': 'SUSE:sles-12-sp5:gen2:latest',

src/vm-repair/azext_vm_repair/tests/latest/test_repair_commands.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
import pytest
99
from azure.cli.testsdk import LiveScenarioTest, ResourceGroupPreparer
10+
import json
11+
import re
1012

1113
STATUS_SUCCESS = 'SUCCESS'
1214

13-
15+
@pytest.mark.WindowsManaged
1416
class WindowsManagedDiskCreateRestoreTest(LiveScenarioTest):
1517

1618
@ResourceGroupPreparer(location='westus2')
@@ -44,7 +46,7 @@ def test_vmrepair_WinManagedCreateRestore(self, resource_group):
4446
source_vm = vms[0]
4547
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
4648

47-
49+
@pytest.mark.WindowsUnmanaged
4850
class WindowsUnmanagedDiskCreateRestoreTest(LiveScenarioTest):
4951

5052
@ResourceGroupPreparer(location='westus2')
@@ -79,10 +81,10 @@ def test_vmrepair_WinUnmanagedCreateRestore(self, resource_group):
7981
assert source_vm['storageProfile']['osDisk']['vhd']['uri'] == result['copied_disk_uri']
8082

8183

82-
@pytest.mark.linux
84+
@pytest.mark.linuxManaged
8385
class LinuxManagedDiskCreateRestoreTest(LiveScenarioTest):
8486

85-
@ResourceGroupPreparer(location='eastus')
87+
@ResourceGroupPreparer(location='westus2')
8688
def test_vmrepair_LinuxManagedCreateRestore(self, resource_group):
8789
self.kwargs.update({
8890
'vm': 'vm1'
@@ -114,10 +116,10 @@ def test_vmrepair_LinuxManagedCreateRestore(self, resource_group):
114116
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
115117

116118

117-
@pytest.mark.linux
119+
@pytest.mark.linuxUnmanaged
118120
class LinuxUnmanagedDiskCreateRestoreTest(LiveScenarioTest):
119121

120-
@ResourceGroupPreparer(location='eastus')
122+
@ResourceGroupPreparer(location='westus2')
121123
def test_vmrepair_LinuxUnmanagedCreateRestore(self, resource_group):
122124
self.kwargs.update({
123125
'vm': 'vm1'
@@ -148,7 +150,7 @@ def test_vmrepair_LinuxUnmanagedCreateRestore(self, resource_group):
148150
source_vm = vms[0]
149151
assert source_vm['storageProfile']['osDisk']['vhd']['uri'] == result['copied_disk_uri']
150152

151-
153+
@pytest.mark.WinManagedDiskPubIpRestore
152154
class WindowsManagedDiskCreateRestoreTestwithpublicip(LiveScenarioTest):
153155

154156
@ResourceGroupPreparer(location='westus2')
@@ -182,7 +184,7 @@ def test_vmrepair_WinManagedCreateRestorePublicIp(self, resource_group):
182184
source_vm = vms[0]
183185
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
184186

185-
187+
@pytest.mark.WinUnmanagedDiskPubIpRestore
186188
class WindowsUnmanagedDiskCreateRestoreTestwithpublicip(LiveScenarioTest):
187189

188190
@ResourceGroupPreparer(location='westus2')
@@ -216,7 +218,7 @@ def test_vmrepair_WinUnmanagedCreateRestorePublicIp(self, resource_group):
216218
source_vm = vms[0]
217219
assert source_vm['storageProfile']['osDisk']['vhd']['uri'] == result['copied_disk_uri']
218220

219-
221+
@pytest.mark.LinuxManagedDiskPubIpRestore
220222
class LinuxManagedDiskCreateRestoreTestwithpublicip(LiveScenarioTest):
221223

222224
@ResourceGroupPreparer(location='eastus')
@@ -250,7 +252,7 @@ def test_vmrepair_LinuxManagedCreateRestorePublicIp(self, resource_group):
250252
source_vm = vms[0]
251253
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
252254

253-
255+
@pytest.mark.LinuxUnmanagedDiskPubIpRestore
254256
class LinuxUnmanagedDiskCreateRestoreTestwithpublicip(LiveScenarioTest):
255257

256258
@ResourceGroupPreparer(location='westus2')
@@ -394,7 +396,7 @@ def test_vmrepair_LinuxSinglepassKekEncryptedManagedDiskCreateRestore(self, reso
394396
source_vm = vms[0]
395397
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
396398

397-
399+
@pytest.mark.WindowsNoKekRestore
398400
class WindowsSinglepassNoKekEncryptedManagedDiskCreateRestoreTest(LiveScenarioTest):
399401

400402
@ResourceGroupPreparer(location='westus2')
@@ -439,7 +441,7 @@ def test_vmrepair_WinSinglepassNoKekEncryptedManagedDiskCreateRestore(self, reso
439441
source_vm = vms[0]
440442
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
441443

442-
444+
@pytest.mark.LinuxNoKekRestore
443445
class LinuxSinglepassNoKekEncryptedManagedDiskCreateRestoreTest(LiveScenarioTest):
444446

445447
@ResourceGroupPreparer(location='westus2')
@@ -486,7 +488,7 @@ def test_vmrepair_LinuxSinglepassNoKekEncryptedManagedDiskCreateRestoreTest(self
486488
source_vm = vms[0]
487489
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
488490

489-
491+
@pytest.mark.WindHelloWorld
490492
class WindowsRunHelloWorldTest(LiveScenarioTest):
491493

492494
@ResourceGroupPreparer(location='westus2')
@@ -507,7 +509,7 @@ def test_vmrepair_WinRunHelloWorld(self, resource_group):
507509
# Check Output
508510
assert 'Hello World!' in result['output']
509511

510-
512+
@pytest.mark.LinHelloWorld
511513
class LinuxRunHelloWorldTest(LiveScenarioTest):
512514

513515
@ResourceGroupPreparer(location='westus2')
@@ -528,7 +530,7 @@ def test_vmrepair_LinuxRunHelloWorld(self, resource_group):
528530
# Check Output
529531
assert 'Hello World!' in result['output']
530532

531-
533+
@pytest.mark.ManagedDiskGen2
532534
class WindowsManagedDiskCreateRestoreGen2Test(LiveScenarioTest):
533535

534536
@ResourceGroupPreparer(location='westus2')
@@ -562,7 +564,7 @@ def test_vmrepair_WinManagedCreateRestoreGen2(self, resource_group):
562564
source_vm = vms[0]
563565
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
564566

565-
567+
@pytest.mark.linuxKekRHEL
566568
class LinuxSinglepassKekEncryptedManagedDiskWithRHEL8DistroCreateRestoreTest(LiveScenarioTest):
567569

568570
@ResourceGroupPreparer(location='westus2')
@@ -617,7 +619,7 @@ def test_vmrepair_LinuxSinglepassKekEncryptedManagedDiskCreateRestoreRHEL8(self,
617619
source_vm = vms[0]
618620
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
619621

620-
622+
@pytest.mark.linuxNoKekWithSles
621623
class LinuxSinglepassNoKekEncryptedManagedDiskWithSLES15CreateRestoreTest(LiveScenarioTest):
622624

623625
@ResourceGroupPreparer(location='westus2')
@@ -645,7 +647,7 @@ def test_vmrepair_LinuxSinglepassNoKekEncryptedManagedDiskCreateRestoreTestSLES1
645647
# Add buffer time for encryption settings to be set
646648
time.sleep(300)
647649

648-
# Test create
650+
# Test create SUSE
649651
result = self.cmd('vm repair create -g {rg} -n {vm} --repair-username azureadmin --repair-password !Passw0rd2018 --distro sles15 --unlock-encrypted-vm --yes -o json').get_output_in_json()
650652
assert result['status'] == STATUS_SUCCESS, result['error_message']
651653

@@ -664,7 +666,7 @@ def test_vmrepair_LinuxSinglepassNoKekEncryptedManagedDiskCreateRestoreTestSLES1
664666
source_vm = vms[0]
665667
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
666668

667-
669+
@pytest.mark.LinuxManagedPubIpOracle
668670
class LinuxManagedDiskCreateRestoreTestwithOracle8andpublicip(LiveScenarioTest):
669671

670672
@ResourceGroupPreparer(location='westus2')
@@ -698,7 +700,7 @@ def test_vmrepair_LinuxManagedCreateRestoreOracle8PublicIp(self, resource_group)
698700
source_vm = vms[0]
699701
assert source_vm['storageProfile']['osDisk']['name'] == result['copied_disk_name']
700702

701-
703+
@pytest.mark.WindowsResetNic
702704
class ResetNICWindowsVM(LiveScenarioTest):
703705

704706
@ResourceGroupPreparer(location='westus2')
@@ -752,7 +754,7 @@ def test_vmrepair_RepairAndRestoreLinuxVM(self, resource_group):
752754
class LinuxARMManagedDiskCreateRestoreTest(LiveScenarioTest):
753755

754756
@ResourceGroupPreparer(location='eastus')
755-
def test_vmrepair_LinuxManagedCreateRestore(self, resource_group):
757+
def test_vmrepair_LinuxARMManagedCreateRestore(self, resource_group):
756758
self.kwargs.update({
757759
'vm': 'vm1'
758760
})
@@ -786,7 +788,7 @@ def test_vmrepair_LinuxManagedCreateRestore(self, resource_group):
786788
class ResetNICWithASG(LiveScenarioTest):
787789

788790
@ResourceGroupPreparer(location='westus2')
789-
def test_vmrepair_ResetNicWindowsVM(self, resource_group):
791+
def test_vmrepair_ResetNicWithASGWindowsVM(self, resource_group):
790792
self.kwargs.update({
791793
'vm': 'vm1'
792794
})

src/vm-repair/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from codecs import open
99
from setuptools import setup, find_packages
1010

11-
VERSION = "1.0.8"
11+
VERSION = "1.0.9"
1212

1313
CLASSIFIERS = [
1414
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)