Skip to content

AzureRT updates #800

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 18 commits into from
Aug 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
eb8d765
Change warning message to non-terminating error message when there is…
hyonholee Aug 25, 2015
3926be0
Add Id parameter to VM cmdlets in order to support piping scenario wi…
hyonholee Aug 25, 2015
91c91a0
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 25, 2015
1d39572
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 26, 2015
6e92616
Updated changelog of AzureRT
hyonholee Aug 26, 2015
ac49597
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 26, 2015
6ec671e
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 26, 2015
10aa73f
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 28, 2015
a4d817c
Fix Set-AzureVMAccess extension
hyonholee Aug 28, 2015
1306cad
Update Publish-AzurePlatformExtension and Set-AzurePlatformExtension …
hyonholee Aug 28, 2015
c128d41
Adding Add-AzureVhd cmdlet for ARM
hyonholee Aug 28, 2015
07988f8
Add Changelog for AzureRT
hyonholee Aug 28, 2015
bb8d958
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 28, 2015
08f59a4
Re-record TestVMImageCmdletOutputFormat test
hyonholee Aug 28, 2015
5aa8607
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 28, 2015
3bd2b72
Fix VM tests in order to continue the test scripts on non-terminating…
hyonholee Aug 28, 2015
7c7ca9d
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 29, 2015
a367614
Fix Network scenario tests in order to continue the test scripts on n…
hyonholee Aug 29, 2015
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
11 changes: 10 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
## 2015.09.03 version 0.9.8
* Azure Compute (ARM) Cmdlets
* Add -Launch parameter for Get-AzureRemoteDesktopFile cmdlet
* Added -Launch parameter for Get-AzureRemoteDesktopFile cmdlet
* Added Id parameter for VM cmdlets to support piping scenario without ResourceGroupName parameter
* Added Set-AzureVMDataDisk cmdlet
* Added Add-AzureVhd cmdlet
* Changed the output format of Get image cmdlets as a table
* Fixed Set-AzureVMAccessExtension cmdlet
* Azure Compute (Service Management) cmdlets
* Changed the warning message to a non-terminating error message for ResourceNotFound in VM cmdlets
* Exposed ComputeImageConfig in Get-AzurePlatformVMImage cmdlet
* Fixed Publish-AzurePlatformExtension and Set-AzurePlatformExtension cmdlets
* Azure Backup - added the following cmdlets
* Backup-AzureRMBackupItem
* Register-AzureRMBackupContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ Tests Create-AzureVM with valid information.
#>
function Test-GetAzureVM
{
# Setup
# Virtual Machine cmdlets are now showing a non-terminating error message for ResourceNotFound
# To continue script, $ErrorActionPreference should be set to 'SilentlyContinue'.
$ErrorActionPreference='SilentlyContinue';

# Setup
$location = Get-DefaultLocation
$imgName = Get-DefaultImage $location

Expand Down Expand Up @@ -74,6 +77,10 @@ function Run-ServiceManagementCloudExceptionTests
# Test Start/Stop-AzureVM for Multiple VMs
function Run-StartAndStopMultipleVirtualMachinesTest
{
# Virtual Machine cmdlets are now showing a non-terminating error message for ResourceNotFound
# To continue script, $ErrorActionPreference should be set to 'SilentlyContinue'.
$ErrorActionPreference='SilentlyContinue';

# Setup
$location = Get-DefaultLocation;
$imgName = Get-DefaultImage $location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Common\ComputeTestController.cs" />
<Compile Include="ScenarioTests\AddVhdTests.cs" />
<Compile Include="ScenarioTests\ComputeCloudExceptionTests.cs" />
<Compile Include="ScenarioTests\VMDynamicTests.cs" />
<Compile Include="ScenarioTests\VirtualMachineProfileTests.cs" />
Expand Down Expand Up @@ -204,6 +205,9 @@
<Link>ScenarioTests\Common.ps1</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\AddVhdTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\ComputeCloudExceptionTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -239,6 +243,9 @@
<None Include="ScenarioTests\VirtualMachineTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.AddVhdTests\TestAddVhd.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.AvailabilitySetTests\TestAvailabilitySet.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -305,6 +312,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineListWithPaging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachinePiping.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachinePIRv2.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
{
public class AddVhdTests
{
[Fact(Skip = "TODO: only works for live mode")]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAddVhd()
{
ComputeTestController.NewInstance.RunPsTest("Test-AddVhd");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Test Add Vhd
#>
function Test-AddVhd
{
# Setup
$rgname = Get-ComputeTestResourceName

try
{
# Common
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

# Storage Account (SA)
$stoname = 'sto' + $rgname;
$stotype = 'Standard_GRS';
New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
$stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
$storageKey = Get-AzureStorageAccountKey -ResourceGroupName $rgname -Name $stoname;
$vhdContainerName = 'vhds';

$path = (get-item -path ".\").FullName;

$csvFile = "upload_VHD.csv";
$csvPath = "..\..\..\..\..\ServiceManagement\Compute\Commands.ServiceManagement.Test\Resources\" + $csvFile;
$testData = Import-Csv $csvPath;

foreach ($testItem in $testData)
{
$vhdLocalPath = 'e:\vhdstore\' + $testItem.vhdName;
$vhdName = GetFileNameWithoutExtension $testItem.vhdName;
$vhdDestUri = [System.String]::Format("{0}{1}/{2}{3}.vhd", $stoaccount.PrimaryEndpoints.Blob.AbsoluteUri, $vhdContainerName, $vhdName, $rgname);
Write-Output ("Start Uploading... : " + $testItem.vhdName);

$vhdUploadContext = Add-AzureVhd -ResourceGroupName $rgname -Destination $vhdDestUri -LocalFilePath $vhdLocalPath -NumberOfUploaderThreads 1;
Start-Sleep -s 5;

Write-Output ("Destination Uri :" + $vhdUploadContext.DestinationUri);
Write-Output ("Local File :" + $vhdUploadContext.LocalFilePath.FullName);
Write-Output ("Uploading Ended.");

Assert-NotNull $vhdUploadContext;
Assert-AreEqual $vhdDestUri $vhdUploadContext.DestinationUri;
Assert-AreEqual $vhdLocalPath $vhdUploadContext.LocalFilePath.FullName;

Write-Output ($vhdDestUri);
Write-Output ($storageKey.Key1);

$destBlobHandle = GetBlobHandle $vhdDestUri $storageKey.Key1;
Assert-True {VerifyMD5hash $destBlobHandle $testItem.md5hash};
}
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

function GetFileNameWithoutExtension ($fileName)
{
$fileName.Substring(0, $fileName.IndexOf('.'));
}

function GetBlobHandle
{
param([string] $blobString, [string] $storageKey)

$blobPath = [Microsoft.WindowsAzure.Commands.Sync.Download.BlobUri] $null;
[Microsoft.WindowsAzure.Commands.Sync.Download.BlobUri]::TryParseUri($blobString, [REF]$blobPath);
$blob = [Microsoft.WindowsAzure.Commands.Sync.Download.BlobHandle]::new($blobPath, $storageKey);
return [Microsoft.WindowsAzure.Commands.Sync.Download.BlobHandle] $blob;
}

function VerifyMD5hash
{
param([System.Object] $blobHandle, [string] $md5hash)

$blobMd5 = $blobHandle.Blob.Properties.ContentMD5;
Write-Output ("MD5 hash of the local file: " + $md5hash);
if ([System.String]::IsNullOrEmpty($blobMd5))
{
Write-Output ("The blob does not have MD5 value!!!");
return $false;
}
else
{
Write-Output ("MD5 hash of blob, "+ $blobHandle.Blob.Uri.ToString() + ", is "+ $blobMd5);
return $blobMd5.Equals($md5hash);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -726,13 +726,6 @@ function Test-VirtualMachineAccessExtension
Assert-AreEqual $p.OSProfile.AdminPassword $password;
Assert-AreEqual $p.OSProfile.WindowsConfiguration.ProvisionVMAgent $true;

# TODO : The test is outdated, need re-recording and re-enabling these fields for validation
#
# Assert-AreEqual $p.StorageProfile.ImageReference.Offer $imgRef.Offer;
# Assert-AreEqual $p.StorageProfile.ImageReference.Publisher $imgRef.PublisherName;
# Assert-AreEqual $p.StorageProfile.ImageReference.Sku $imgRef.Skus;
# Assert-AreEqual $p.StorageProfile.ImageReference.Version $imgRef.Version;

# Virtual Machine
# TODO: Still need to do retry for New-AzureVM for SA, even it's returned in Get-.
New-AzureVM -ResourceGroupName $rgname -Location $loc -VM $p;
Expand All @@ -758,6 +751,7 @@ function Test-VirtualMachineAccessExtension
Assert-AreEqual $ext.TypeHandlerVersion $extver;
Assert-AreEqual $ext.UserName $user2;
Assert-NotNull $ext.ProvisioningState;
Assert-True {$ext.PublicSettings.Contains("UserName")};

$ext = Get-AzureVMAccessExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Status;
Assert-AreEqual $ext.ResourceGroupName $rgname;
Expand All @@ -767,20 +761,14 @@ function Test-VirtualMachineAccessExtension
Assert-AreEqual $ext.TypeHandlerVersion $extver;
Assert-NotNull $ext.ProvisioningState;
Assert-NotNull $ext.Statuses;
Assert-True {$ext.PublicSettings.Contains("UserName")};

# Get VM
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
Assert-AreEqual $vm1.Name $vmname;
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces.Count 1;
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;

# TODO : The test is outdated, need re-recording and re-enabling these fields for validation
#
# Assert-AreEqual $vm1.StorageProfile.ImageReference.Offer $imgRef.Offer;
# Assert-AreEqual $vm1.StorageProfile.ImageReference.Publisher $imgRef.PublisherName;
# Assert-AreEqual $vm1.StorageProfile.ImageReference.Sku $imgRef.Skus;
# Assert-AreEqual $vm1.StorageProfile.ImageReference.Version $imgRef.Version;

Assert-AreEqual $vm1.OSProfile.AdminUsername $user;
Assert-AreEqual $vm1.OSProfile.ComputerName $computerName;
Assert-AreEqual $vm1.HardwareProfile.VirtualMachineSize $vmsize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public void TestVirtualMachine()
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachine");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVirtualMachinePiping()
{
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachinePiping");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestLinuxVirtualMachine()
Expand Down
Loading