Skip to content

[Release 1.6.0] [AzureRT] Add Redeploy and Migration validation features #2583

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

Merged
merged 1 commit into from
Jul 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.8.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.13.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.2.4-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.8.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="6.0.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="13.0.0" targetFramework="net45" />
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@
<Reference Include="Microsoft.WindowsAzure.Management">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=12.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=13.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.8.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.13.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.3\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.WebSites, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -289,6 +289,9 @@
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunNewAzureComputeParameterObjectTests.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunRedeployVirtualMachineTest.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunServiceDeploymentExtensionCmdletTests.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<#
$PLACEHOLDER = "PLACEHOLDER1@";

<#
.SYNOPSIS
End to end DSC test that tests Get-AzureVMDscExtension cmdlet. It does the following:
1) Publishes a configuration to the default storage account using Publish-AzureVMDscConfiguration cmdlet
Expand Down Expand Up @@ -34,8 +36,7 @@ function Test-GetAzureVMDscExtension

# Test
New-AzureService -ServiceName $svcName -Location $location
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd"
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password $PLACEHOLDER

$vm = Get-AzureVM -ServiceName $svcName -Name $vmName

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

$PLACEHOLDER = "PLACEHOLDER1@";

<#
.SYNOPSIS
Tests Create-AzureVM with valid information.
Expand All @@ -33,8 +35,7 @@ function Test-GetAzureVM

# Test
New-AzureService -ServiceName $svcName -Location $location
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd"
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password $PLACEHOLDER

Get-AzureVM -ServiceName $svcName -Name $vmName

Expand Down Expand Up @@ -92,7 +93,7 @@ function Run-StartAndStopMultipleVirtualMachinesTest
$vmNameList = @("vm01", "vm02", "test04");
$svcName = 'pstest' + (Get-CloudServiceName);
$userName = "pstestuser";
$password = "p@ssw0rd";
$password = $PLACEHOLDER;

# Test
New-AzureService -ServiceName $svcName -Location $location;
Expand Down Expand Up @@ -153,7 +154,7 @@ function Run-AutoGeneratedHostedServiceCmdletTests
$vmNameList = @("vm01", "vm02", "test04");
$svcName = 'pstest' + (Get-CloudServiceName);
$userName = "pstestuser";
$password = "p@ssw0rd";
$password = $PLACEHOLDER;

try
{
Expand Down Expand Up @@ -220,7 +221,7 @@ function Run-AutoGeneratedVirtualMachineCmdletTests

$svcName = 'pstest' + (Get-CloudServiceName);
$userName = "pstestuser";
$password = "p@ssw0rd";
$password = $PLACEHOLDER;

try
{
Expand Down Expand Up @@ -480,7 +481,7 @@ function Run-ServiceExtensionSetCmdletTests

$svcName = 'pstest' + (Get-CloudServiceName);
$userName = "pstestuser";
$password = "p@ssw0rd";
$password = $PLACEHOLDER;
$sPassword = ConvertTo-SecureString $password -AsPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential ($userName, $sPassword);

Expand Down Expand Up @@ -542,7 +543,7 @@ function Run-ServiceDeploymentExtensionCmdletTests

$svcName = 'pstest' + (Get-CloudServiceName);
$userName = "pstestuser";
$password = "p@ssw0rd";
$password = $PLACEHOLDER;
$sPassword = ConvertTo-SecureString $password -AsPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential ($userName, $sPassword);

Expand Down Expand Up @@ -630,8 +631,7 @@ function Test-MigrateAzureDeployment

# Test
New-AzureService -ServiceName $svcName -Location $location;
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd";
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password $PLACEHOLDER;
Get-AzureVM -ServiceName $svcName -Name $vmName;

Move-AzureService -Prepare -ServiceName $svcName -DeploymentName $svcName -CreateNewVirtualNetwork;
Expand Down Expand Up @@ -670,10 +670,12 @@ function Test-MigrationAbortAzureDeployment

# Test
New-AzureService -ServiceName $svcName -Location $location;
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd";
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password $PLACEHOLDER -WaitForBoot;
Get-AzureVM -ServiceName $svcName -Name $vmName;

Move-AzureService -Validate -ServiceName $svcName -DeploymentName $svcName -CreateNewVirtualNetwork;
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;

Move-AzureService -Prepare -ServiceName $svcName -DeploymentName $svcName -CreateNewVirtualNetwork;
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
Assert-AreEqual "Prepared" $vm.VM.MigrationState;
Expand Down Expand Up @@ -733,15 +735,15 @@ function Test-MigrationAbortAzureVNet
# Test

Set-AzureVNetConfig -ConfigurationPath $vnetConfigPath;
Get-AzureVNetSite;

Move-AzureVirtualNetwork -Validate -VirtualNetworkName $vnetName;
Get-AzureVNetSite;

Move-AzureVirtualNetwork -Prepare -VirtualNetworkName $vnetName;

Get-AzureVNetSite;

Move-AzureVirtualNetwork -Abort -VirtualNetworkName $vnetName;

Get-AzureVNetSite;

# Cleanup
Expand All @@ -755,17 +757,17 @@ Tests Move-AzureStorageAccount with Prepare and Commit
function Test-MigrateAzureStorageAccount
{
# Setup
$location = "Central US";
$location = "Central US";
$storageName = getAssetName;
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
Get-AzureStorageAccount -StorageAccountName $storageName;
Get-AzureStorageAccount -StorageAccountName $storageName;

# Test
Move-AzureStorageAccount -Prepare -StorageAccountName $storageName;
Get-AzureStorageAccount -StorageAccountName $storageName;

Move-AzureStorageAccount -Commit -StorageAccountName $storageName;
Assert-ThrowsContains { Get-AzureStorageAccount -StorageAccountName $storageName; } "ResourceNotFound";
Assert-ThrowsContains { Get-AzureStorageAccount -StorageAccountName $storageName; } "ResourceNotFound";
}

<#
Expand All @@ -775,12 +777,15 @@ Tests Move-AzureStorageAccount with Prepare and Abort
function Test-MigrationAbortAzureStorageAccount
{
# Setup
$location = "Central US";
$location = "Central US";
$storageName = getAssetName;
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
Get-AzureStorageAccount -StorageAccountName $storageName;
Get-AzureStorageAccount -StorageAccountName $storageName;

# Test
Move-AzureStorageAccount -Validate -StorageAccountName $storageName;
Get-AzureStorageAccount -StorageAccountName $storageName;

Move-AzureStorageAccount -Prepare -StorageAccountName $storageName;
Get-AzureStorageAccount -StorageAccountName $storageName;

Expand All @@ -806,7 +811,7 @@ function Test-NewAzureVMWithBYOL
$licenseType = "Windows_Server";
$imgName = getAssetName;
$userName = "User" + $svcName;
$pass = "User@" + $svcName;
$pass = $PLACEHOLDER;

$media1 = "http://mybyolosimagerdfe.blob.core.windows.net/myvhd/" + $svcName + "0.vhd";
$media2 = "http://mybyolosimagerdfe.blob.core.windows.net/myvhd/" + $svcName + "1.vhd";
Expand Down Expand Up @@ -848,3 +853,42 @@ function Test-NewAzureVMWithBYOL
# Cleanup
Cleanup-CloudService $svcName
}

# Test Redeploy VM
function Run-RedeployVirtualMachineTest
{
# Setup
$location = Get-DefaultLocation;
$imgName = Get-DefaultImage $location;

$storageName = 'pstest' + (getAssetName);
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;

# Associate the new storage account with the current subscription
Set-CurrentStorageAccountName $storageName;

$vmName = "vm01";
$svcName = 'pstest' + (Get-CloudServiceName);
$userName = "pstestuser";
$password = $PLACEHOLDER;

# Test
New-AzureService -ServiceName $svcName -Location $location;

try
{
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername $userName -Password $password;
# Get VM
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;

# Test Redeploy
Restart-AzureVM -Redeploy -ServiceName $svcName -Name $vmName;

$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
}
finally
{
# Cleanup
Cleanup-CloudService $svcName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,14 @@ public void TestNewAzureVMWithBYOL()
{
this.RunPowerShellTest("Test-NewAzureVMWithBYOL");
}

[Fact]
[Trait(Category.Service, Category.ServiceManagement)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.AcceptanceType, Category.BVT)]
public void RunRedeployVirtualMachineTest()
{
this.RunPowerShellTest("Run-RedeployVirtualMachineTest");
}
}
}
Loading