Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c30ba14
Merge pull request #20 from huangpf/dev
AzureRT Mar 24, 2015
b0274dd
Merge branch 'release-0.8.16' of https://github.com/Azure/azure-power…
huangpf Mar 31, 2015
c04a21f
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
Apr 2, 2015
eacd4dc
Add mocked test to validate DateTime.Max values
Apr 2, 2015
5b696fd
Merge branch 'dev' of https://github.com/AzureRT/azure-powershell int…
huangpf Apr 13, 2015
8dea60f
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Apr 13, 2015
af18570
Merge pull request #1 from Azure/dev
huangpf Apr 30, 2015
e8e669c
Merge pull request #2 from Azure/master
huangpf May 5, 2015
45dfa3b
Merge pull request #3 from Azure/dev
huangpf May 6, 2015
d33d22b
Merge pull request #4 from Azure/dev
huangpf May 8, 2015
a967e48
update model classes
huangpf May 12, 2015
b99edf4
update
huangpf May 12, 2015
f1df0b4
Merge pull request #5 from Azure/dev
huangpf May 14, 2015
afd0f58
Merge pull request #6 from Azure/dev
huangpf May 15, 2015
fa75814
Merge pull request #7 from Azure/dev
huangpf May 18, 2015
55f1e06
Merge pull request #8 from Azure/dev
huangpf May 19, 2015
e59611e
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf May 20, 2015
fa3ee24
Merge branch 'dev' of https://github.com/huangpf/azure-powershell int…
huangpf May 20, 2015
9cec9e3
update
huangpf May 20, 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
7 changes: 5 additions & 2 deletions src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AutomationTests\TestAutomationSuspendAndResumeJob.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AzureVMTests\TestGetAzureVM.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.SchedulerTests\TestSchedulerEndToEnd.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -284,10 +287,10 @@
<Compile Include="Resources\ResourceLocator.cs" />
<Compile Include="Scheduler\SchedulerTests.cs" />
<Compile Include="ServiceBusTests\ServiceBusAuthorizationRuleTests.cs" />
<Compile Include="ServiceManagement\GetVMTests.cs" />
<Compile Include="StorageTests\StorageContainerTest.cs" />
<Compile Include="StorageTests\StorageContextTest.cs" />
<Compile Include="StoreTests\StoreTests.cs" />
<Compile Include="ServiceManagement\VMProvisionScenarioTests.cs" />
<Compile Include="TrafficManagerTests\TrafficManagerTests.cs" />
<Compile Include="WAPackIaaS\CloudService\CmdletTestCloudServiceBase.cs" />
<Compile Include="WAPackIaaS\CloudService\GetWAPackCloudServiceTests.cs" />
Expand Down Expand Up @@ -408,7 +411,7 @@
<None Include="Resources\CloudService\Cache\mc.tgz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\ServiceManagement\VMProvisionTests.ps1">
<None Include="Resources\ServiceManagement\AzureVMTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\ServiceManagement\Common.ps1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,30 @@
.SYNOPSIS
Tests Create-AzureVM with valid information.
#>
function Test-CreateWindowsAzureQuickVM
function Test-GetAzureVM
{
# Setup

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


$storageName = getAssetName
New-AzureStorageAccount -StorageAccountName $storageName -Location $location

Set-CurrentStorageAccountName $storageName

$vmName = "vm1"
$svcName = Get-CloudServiceName

# Test
New-AzureQuickVM -Windows -ImageName $imageName -Name $newAzureQuickVMName -ServiceName $newAzureQuickVMSvcName -Password "p@ssw0rd" -Location $location
}
New-AzureService -ServiceName $svcName -Location $location
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd"

Get-AzureVM -ServiceName $svcName -Name $vmName


# Cleanup
Cleanup-CloudService $svcName
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,79 @@
# limitations under the License.
# ----------------------------------------------------------------------------------


<#
.SYNOPSIS
Sets
Sets the default storage account
#>
function Set-CurrentStorageAccountName
{
Get-AzureSubscription -Default | Set-AzureSubscription -CurrentStorageAccountName ""
}
param([string] $storageAccountName)
$currentSubscription = Get-AzureSubscription -Current

Set-AzureSubscription -SubscriptionId $currentSubscription.SubscriptionId -CurrentStorageAccountName $storageAccountName
}

<#
.SYNOPSIS
Gets the default location
#>
function Get-DefaultLocation
{
return (Get-AzureLocation)[0].Name
}

<#
.SYNOPSIS
Gets the default image
#>
function Get-DefaultImage
{
param([string] $loc)
return (Get-AzureVMImage | where {$_.OS -eq "Windows"} | where {$_.Location.Contains($loc)})[0].ImageName
}


<#
.SYNOPSIS
Gets valid and available cloud service name.
#>
function Get-CloudServiceName
{
return getAssetName
}

<#
.SYNOPSIS
Cleanup cloud service
#>
function Cleanup-CloudService
{
param([string] $name)
try
{
Remove-AzureService -ServiceName $name -Force
}
catch
{
Write-Warning "Cannot Remove the Cloud Service"
}
}

<#
.SYNOPSIS
Cleanup storage
#>
function Cleanup-Storage
{
param([string] $name)
Remove-AzureStorageAccount -StorageAccountName $name
try
{
Remove-AzureStorageAccount -StorageAccountName $name
}
catch
{
Write-Warning "Cannot Remove the Storage Account"
}
}
63 changes: 63 additions & 0 deletions src/Common/Commands.ScenarioTest/ServiceManagement/GetVMTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// ----------------------------------------------------------------------------------
//
// 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.Azure.Common.Authentication;
using Microsoft.Azure.Test;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;

namespace Microsoft.WindowsAzure.Commands.ScenarioTest
{
public class AzureVMTests
{
private EnvironmentSetupHelper helper = new EnvironmentSetupHelper();

#region Get-AzureVM Scenario Tests

[Fact]
[Trait(Category.Service, Category.ServiceManagement)]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
[Trait(Category.AcceptanceType, Category.BVT)]
public void TestGetAzureVM()
{
this.RunPowerShellTest("Test-GetAzureVM");
}
#endregion

protected void SetupManagementClients()
{
helper.SetupSomeOfManagementClients();
}

protected void RunPowerShellTest(params string[] scripts)
{
using (UndoContext context = UndoContext.Current)
{
context.Start(TestUtilities.GetCallingClass(1), TestUtilities.GetCurrentMethodName(2));

SetupManagementClients();

List<string> modules = Directory.GetFiles("Resources\\ServiceManagement", "*.ps1").ToList();
modules.Add("Common.ps1");

helper.SetupEnvironment(AzureModule.AzureServiceManagement);
helper.SetupModules(AzureModule.AzureServiceManagement, modules.ToArray());

helper.RunPowerShellTest(scripts);
}
}
}
}

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<Compile Include="Extension\GetAzureVMExtensionCommand.cs" />
<Compile Include="Images\GetAzureVMImageCommand.cs" />
<Compile Include="Models\HashTableExtensions.cs" />
<Compile Include="Models\PSOperation.cs" />
<Compile Include="Extension\VMAccess\GetAzureVMAccessExtension.cs" />
<Compile Include="Extension\VMAccess\RemoveAzureVMAccessExtension.cs" />
<Compile Include="Extension\VMAccess\SetAzureVMAccessExtension.cs" />
Expand All @@ -175,7 +176,6 @@
<Compile Include="Images\GetAzureVMImageOfferCommand.cs" />
<Compile Include="Images\GetAzureVMImageDetailCommand.cs" />
<Compile Include="Images\VirtualMachineImageBaseCmdlet.cs" />
<Compile Include="Models\PSOperationContext.cs" />
<Compile Include="Models\PSUsage.cs" />
<Compile Include="Models\PSVirtualMachineExtensionImage.cs" />
<Compile Include="Models\PSVirtualMachineImage.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
//

// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
-->
<Configuration>
<ViewDefinitions>
<View>
Expand All @@ -10,6 +32,10 @@
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>ResourceGroupName</Label>
<PropertyName>ResourceGroupName</PropertyName>
</ListItem>
<ListItem>
<Label>Id</Label>
<PropertyName>Id</PropertyName>
Expand Down Expand Up @@ -128,6 +154,10 @@
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>ResourceGroupName</Label>
<PropertyName>ResourceGroupName</PropertyName>
</ListItem>
<ListItem>
<Label>Id</Label>
<PropertyName>Id</PropertyName>
Expand Down
Loading