Skip to content

[do not merge] Try output op id in LRO #479

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

Closed
wants to merge 5 commits into from
Closed
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
4 changes: 4 additions & 0 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\TestGetAzureLocation.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AzureVMTests\TestGetAzureVM.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -287,6 +290,7 @@
<Compile Include="Resources\ResourceLocator.cs" />
<Compile Include="Scheduler\SchedulerTests.cs" />
<Compile Include="ServiceBusTests\ServiceBusAuthorizationRuleTests.cs" />
<Compile Include="ServiceManagement\GetLocationTests.cs" />
<Compile Include="ServiceManagement\GetVMTests.cs" />
<Compile Include="StorageTests\StorageContainerTest.cs" />
<Compile Include="StorageTests\StorageContextTest.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,52 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

########################################################################### Create-AzureVM Scenario Tests ###########################################################################

<#
.SYNOPSIS
Tests Create-AzureVM with valid information.
#>
function Test-GetAzureVM
{
# Setup
# Setup

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


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

Set-CurrentStorageAccountName $storageName
Set-CurrentStorageAccountName $storageName

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

# Test
New-AzureService -ServiceName $svcName -Location $location
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd"
# Test
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
Get-AzureVM -ServiceName $svcName -Name $vmName


# Cleanup
Cleanup-CloudService $svcName
# Cleanup
Cleanup-CloudService $svcName
}


<#
.SYNOPSIS
Test Get-AzureLocation
#>
function Test-GetAzureLocation
{
$locations = Get-AzureLocation;

foreach ($loc in $locations)
{
$svcName = getAssetName;
$st = New-AzureService -ServiceName $svcName -Location $loc.Name;

# Cleanup
Cleanup-CloudService $svcName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Sets the default storage account
function Set-CurrentStorageAccountName
{
param([string] $storageAccountName)
$currentSubscription = Get-AzureSubscription -Current
$currentSubscription = Get-AzureSubscription -Current

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

<#
Expand All @@ -31,7 +31,7 @@ Gets the default location
#>
function Get-DefaultLocation
{
return (Get-AzureLocation)[0].Name
return (Get-AzureLocation)[0].Name
}

<#
Expand All @@ -41,7 +41,7 @@ Gets the default image
function Get-DefaultImage
{
param([string] $loc)
return (Get-AzureVMImage | where {$_.OS -eq "Windows"} | where {$_.Location.Contains($loc)})[0].ImageName
return (Get-AzureVMImage | where {$_.OS -eq "Windows"} | where {$_.Location.Contains($loc)})[0].ImageName
}


Expand All @@ -51,7 +51,7 @@ Gets valid and available cloud service name.
#>
function Get-CloudServiceName
{
return getAssetName
return getAssetName
}

<#
Expand All @@ -61,14 +61,14 @@ Cleanup cloud service
function Cleanup-CloudService
{
param([string] $name)
try
{
Remove-AzureService -ServiceName $name -Force
}
catch
{
Write-Warning "Cannot Remove the Cloud Service"
}
try
{
Remove-AzureService -ServiceName $name -Force
}
catch
{
Write-Warning "Cannot Remove the Cloud Service"
}
}

<#
Expand All @@ -78,13 +78,13 @@ 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"
}
Remove-AzureStorageAccount -StorageAccountName $name
try
{
Remove-AzureStorageAccount -StorageAccountName $name
}
catch
{
Write-Warning "Cannot Remove the Storage Account"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// ----------------------------------------------------------------------------------
//
// 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.Common;
using Xunit;

namespace Microsoft.WindowsAzure.Commands.ScenarioTest
{
public partial class AzureVMTests
{
[Fact]
[Trait(Category.Service, Category.ServiceManagement)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.AcceptanceType, Category.BVT)]
public void TestGetAzureLocation()
{
this.RunPowerShellTest("Test-GetAzureLocation");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

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

Expand Down Expand Up @@ -52,9 +52,10 @@ protected void RunPowerShellTest(params string[] scripts)

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

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

helper.RunPowerShellTest(scripts);
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ function Get-ComputeTestMode
return $testMode;
}


<#
.SYNOPSIS
Get Compute Test Location
#>
function Get-ComputTestLocation
{
return $env:AZURE_COMPUTE_TEST_LOCATION;
}


######################
#
# Retry the given code block until it succeeds or times out.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function create_and_setup_nic_ids
$nic_ids = @($null) * 1;
$nic0 = New-AzureNetworkInterface -Force -Name ('nic0' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId;
$nic_ids[0] = $nic0.Id;
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id;
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id -Primary;
$st = Write-Verbose "Creating and getting NICs for '${loc}' and '${rgname}' - End";

return $nic_ids;
Expand Down Expand Up @@ -119,19 +119,19 @@ function setup_image_and_disks
}


function ps_vm_dynamic_test_func_1_pstestrg1016
function ps_vm_dynamic_test_func_1_pstestrg592
{
# Setup
$rgname = 'pstestrg1016';
$rgname = 'pstestrg592';

try
{
$loc = 'West US';
$vmsize = 'Standard_A3';
$loc = 'Japan East';
$vmsize = 'Standard_A2';

$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Start ${rgname}, ${loc} & ${vmsize}";
$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Start ${rgname}, ${loc} & ${vmsize}";

$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Creating Resource Group';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Creating Resource Group';
$st = New-AzureResourceGroup -Location $loc -Name $rgname -Force;

$vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize;
Expand All @@ -146,20 +146,20 @@ function ps_vm_dynamic_test_func_1_pstestrg1016
$st = setup_image_and_disks $loc $rgname $stoname $vmconfig;

# Virtual Machine
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Creating VM';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Creating VM';

$vmname = 'vm' + $rgname;
$st = New-AzureVM -ResourceGroupName $rgname -Location $loc -Name $vmname -VM $vmconfig;

# Get VM
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Getting VM';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Getting VM';
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;

# Remove
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Removing VM';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Removing VM';
$st = Remove-AzureVM -Name $vmname -ResourceGroupName $rgname -Force;

$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - End';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - End';
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function create_and_setup_nic_ids
$nic_ids = @($null) * 1;
$nic0 = New-AzureNetworkInterface -Force -Name ('nic0' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId;
$nic_ids[0] = $nic0.Id;
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id;
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id -Primary;
$st = Write-Verbose "Creating and getting NICs for '${loc}' and '${rgname}' - End";

return $nic_ids;
Expand Down Expand Up @@ -119,19 +119,19 @@ function setup_image_and_disks
}


function ps_vm_dynamic_test_func_2_pstestrg4940
function ps_vm_dynamic_test_func_2_pstestrg2115
{
# Setup
$rgname = 'pstestrg4940';
$rgname = 'pstestrg2115';

try
{
$loc = 'West Europe';
$loc = 'East Asia';
$vmsize = 'Standard_A3';

$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Start ${rgname}, ${loc} & ${vmsize}";
$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Start ${rgname}, ${loc} & ${vmsize}";

$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Creating Resource Group';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Creating Resource Group';
$st = New-AzureResourceGroup -Location $loc -Name $rgname -Force;

$vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize;
Expand All @@ -146,20 +146,20 @@ function ps_vm_dynamic_test_func_2_pstestrg4940
$st = setup_image_and_disks $loc $rgname $stoname $vmconfig;

# Virtual Machine
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Creating VM';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Creating VM';

$vmname = 'vm' + $rgname;
$st = New-AzureVM -ResourceGroupName $rgname -Location $loc -Name $vmname -VM $vmconfig;

# Get VM
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Getting VM';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Getting VM';
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;

# Remove
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Removing VM';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Removing VM';
$st = Remove-AzureVM -Name $vmname -ResourceGroupName $rgname -Force;

$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - End';
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - End';
}
finally
{
Expand Down
Loading