Skip to content

Commit 3fee22f

Browse files
committed
Show MigrationStage for Get-AzureStorageAccount
1 parent 1d1c780 commit 3fee22f

File tree

2 files changed

+41
-36
lines changed

2 files changed

+41
-36
lines changed

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/ServiceManagement/ServiceManagementTests.ps1

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,14 @@ function Test-MigrationAbortAzureStorageAccount
817817
Get-AzureStorageAccount -StorageAccountName $storageName;
818818

819819
Move-AzureStorageAccount -Prepare -StorageAccountName $storageName;
820-
Get-AzureStorageAccount -StorageAccountName $storageName;
820+
$result = Get-AzureStorageAccount -StorageAccountName $storageName;
821+
Assert-AreEqual "Prepared" $result.MigrationState;
822+
$resultOut = $result | Out-String;
821823

822824
Move-AzureStorageAccount -Abort -StorageAccountName $storageName;
823-
Get-AzureStorageAccount -StorageAccountName $storageName;
825+
$result = Get-AzureStorageAccount -StorageAccountName $storageName;
826+
Assert-Null $result.MigrationState;
827+
$resultOut = $result | Out-String;
824828

825829
# Cleanup
826830
Remove-AzureStorageAccount -StorageAccountName $storageName;
@@ -1039,53 +1043,53 @@ function Run-InitiateMaintenanceTest
10391043
# or 400 with error message like "User initiated maintenance on the virtual machine was
10401044
# successfully completed". Both are expected reponses.
10411045
# To continue script, $ErrorActionPreference should be set to 'SilentlyContinue'.
1042-
$tempErrorActionPreference = $ErrorActionPreference;
1046+
$tempErrorActionPreference = $ErrorActionPreference;
10431047
$ErrorActionPreference = 'SilentlyContinue';
1044-
1045-
# Setup
1046-
$location = "Central US EUAP";
1047-
$imgName = Get-DefaultImage $location;
1048+
1049+
# Setup
1050+
$location = "Central US EUAP";
1051+
$imgName = Get-DefaultImage $location;
10481052

1049-
$storageName = 'pstest' + (getAssetName);
1050-
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
1053+
$storageName = 'pstest' + (getAssetName);
1054+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
10511055

1052-
# Associate the new storage account with the current subscription
1053-
Set-CurrentStorageAccountName $storageName;
1056+
# Associate the new storage account with the current subscription
1057+
Set-CurrentStorageAccountName $storageName;
10541058

1055-
$vmName = "psvm01";
1056-
$svcName = 'pstest' + (Get-CloudServiceName);
1057-
$userName = "pstestuser";
1058-
$password = $PLACEHOLDER;
1059+
$vmName = "psvm01";
1060+
$svcName = 'pstest' + (Get-CloudServiceName);
1061+
$userName = "pstestuser";
1062+
$password = $PLACEHOLDER;
10591063

1060-
# Test
1061-
New-AzureService -ServiceName $svcName -Location $location;
1064+
# Test
1065+
New-AzureService -ServiceName $svcName -Location $location;
10621066

1063-
try
1064-
{
1065-
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername $userName -Password $password;
1067+
try
1068+
{
1069+
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername $userName -Password $password;
10661070
#Start-Sleep -s 300; #Uncomment this line for record mode testing.
10671071

1068-
# Get VM
1069-
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
1070-
Assert-NotNull $vm;
1071-
Assert-NotNull $vm.MaintenanceStatus;
1072+
# Get VM
1073+
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
1074+
Assert-NotNull $vm;
1075+
Assert-NotNull $vm.MaintenanceStatus;
10721076

1073-
# Test Initiate Maintenance
1074-
$result = Restart-AzureVM -InitiateMaintenance -ServiceName $svcName -Name $vmName;
1077+
# Test Initiate Maintenance
1078+
$result = Restart-AzureVM -InitiateMaintenance -ServiceName $svcName -Name $vmName;
10751079

1076-
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
1077-
Assert-NotNull $vm.MaintenanceStatus;
1080+
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
1081+
Assert-NotNull $vm.MaintenanceStatus;
10781082
}
10791083
catch
10801084
{
1081-
Assert-True {$result.Result.Contains("User initiated maintenance on the Virtual Machine was successfully completed.")};
1085+
Assert-True {$result.Result.Contains("User initiated maintenance on the Virtual Machine was successfully completed.")};
10821086
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
10831087
Assert-NotNull $vm.MaintenanceStatus;
1084-
}
1085-
finally
1086-
{
1087-
# Cleanup
1088-
Cleanup-CloudService $srcName;
1089-
$ErrorActionPreference = $tempErrorActionPreference;
1090-
}
1088+
}
1089+
finally
1090+
{
1091+
# Cleanup
1092+
Cleanup-CloudService $srcName;
1093+
$ErrorActionPreference = $tempErrorActionPreference;
1094+
}
10911095
}

src/ServiceManagement/Compute/Commands.ServiceManagement/Model/PSStorageService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected PSStorageService(StorageServicePropertiesOperationContext account, Azu
5858
}
5959

6060
this.Endpoints = endpointList;
61+
this.MigrationState = account.MigrationState;
6162
}
6263

6364
public static PSStorageService Create(StorageManagementClient client,

0 commit comments

Comments
 (0)