Skip to content
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
11 changes: 10 additions & 1 deletion src/Azs.Compute.Admin/custom/New-AzsComputeQuota.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,16 @@ param(

process {
# Autorest generated code doesn't throw error in case resource already exists
$resource = Get-AzsComputeQuota -Name $Name -ErrorAction SilentlyContinue
$params = @{}

if ($PSBoundParameters.ContainsKey('Location')){
$params.Add('Location', $Location)
}
if ($PSBoundParameters.ContainsKey('SubscriptionId')){
$params.Add('SubscriptionId', $SubscriptionId)
}

$resource = Get-AzsComputeQuota -Name $Name -ErrorAction SilentlyContinue @params
if ($null -ne $resource) { throw "$($MyInvocation.MyCommand): A compute quota with name $Name at location $($resource.Location) already exists" }
Azs.Compute.Admin.internal\New-AzsComputeQuota @PSBoundParameters
}
Expand Down
2,459 changes: 2,459 additions & 0 deletions src/Azs.Compute.Admin/test/Add-AzsPlatformImage.Recording.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$TestRecordingFile = Join-Path $PSScriptRoot 'PlatformImage.Tests.Recording.json'
. (Join-Path $PSScriptRoot 'loadEnvJson.ps1')

$TestRecordingFile = Join-Path $PSScriptRoot 'Add-AzsPlatformImage.Recording.json'
$currentPath = $PSScriptRoot
while(-not $mockingPath) {
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
Expand All @@ -12,8 +14,6 @@ $global:TestName = ""

Describe 'Get-AzsPlatformImage' {

. $PSScriptRoot\Common.ps1

BeforeEach {

function Create() {
Expand Down Expand Up @@ -53,7 +53,7 @@ Describe 'Get-AzsPlatformImage' {
It "TestListPlatformImages" -Skip:$('TestListPlatformImages' -in $global:SkippedTests) {
$global:TestName = 'TestListPlatformImages'

$platformImages = Get-AzsPlatformImage -Location $global:Location
$platformImages = Get-AzsPlatformImage

$platformImages | Should Not Be $null
foreach ($platformImage in $platformImages) {
Expand All @@ -64,38 +64,40 @@ Describe 'Get-AzsPlatformImage' {
It "TestGetPlatformImage" -Skip:$('TestGetPlatformImage' -in $global:SkippedTests) {
$global:TestName = 'TestGetPlatformImage'

$platformImages = Get-AzsPlatformImage -Location $global:Location
$platformImages = Get-AzsPlatformImage
$platformImages | Should Not Be $null

foreach ($platformImage in $platformImages) {
$result = Get-AzsPlatformImage -Location $global:Location -Publisher $platformImage.publisher -Offer $platformImage.offer -Sku $platformImage.sku -Version $platformImage.version
$result = Get-AzsPlatformImage -Publisher $platformImage.publisher -Offer $platformImage.offer -Sku $platformImage.sku -Version $platformImage.version
AssertSame -Expected $platformImage -Found $result
break
}
}

<# A lot of recordings are missing from this test
It "TestGetAllPlatformImages" -Skip:$('TestGetAllPlatformImages' -in $global:SkippedTests) {
$global:TestName = 'TestGetAllPlatformImages'

$platformImages = Get-AzsPlatformImage -Location $global:Location
$platformImages = Get-AzsPlatformImage
$platformImages | Should Not Be $null
foreach ($platformImage in $platformImages) {
$result = $platformImage | Get-AzsPlatformImage
$result = Get-AzsPlatformImage -InputObject $platformImage
AssertSame -Expected $platformImage -Found $result
}
}
#>

<# TODO: UnComment once the test recordings are added for these tests.

It "TestCreatePlatformImage" -Skip:$('TestCreatePlatformImage' -in $global:SkippedTests) {
$global:TestName = 'TestCreatePlatformImage'

$script:Location = $global:Location;

$script:Publisher = "Canonical";
$script:Offer = "UbuntuServer";
$script:Sku = "16.04-LTS";
$script:Version = "1.0.0";

$image = Add-AzsPlatformImage `
-Location $script:Location `
-Publisher $script:Publisher `
-Offer $script:Offer `
-Sku $script:Sku `
Expand All @@ -116,9 +118,7 @@ Describe 'Get-AzsPlatformImage' {

while ($image.ProvisioningState -eq "Creating") {
# Start-Sleep -Seconds 30
Write-host $script:Location
$image = Get-AzsPlatformImage `
-Location $script:Location `
-Publisher $script:Publisher `
-Offer $script:Offer `
-Sku $script:Sku `
Expand All @@ -132,14 +132,12 @@ Describe 'Get-AzsPlatformImage' {
It "TestCreateAndDeletePlatformImage" -Skip:$('TestCreateAndDeletePlatformImage' -in $global:SkippedTests) {
$global:TestName = 'TestCreateAndDeletePlatformImage'

$script:Location = $global:Location;
$script:Publisher = "Microsoft";
$script:Publisher = "Canonical";
$script:Offer = "UbuntuServer";
$script:Sku = "16.04-LTS";
$script:Version = "1.0.0";

$image = Add-AzsPlatformImage `
-Location $script:Location `
-Publisher $script:Publisher `
-Offer $script:Offer `
-Sku $script:Sku `
Expand All @@ -152,13 +150,13 @@ Describe 'Get-AzsPlatformImage' {

while ($image.ProvisioningState -ne "Succeeded") {
$image = Get-AzsPlatformImage `
-Location $script:Location `
-Publisher $script:Publisher `
-Sku $script:Sku `
-Offer $script:Offer `
-Version $script:version
}
$image.ProvisioningState | Should be "Succeeded"
Remove-AzsPlatformImage -Location $script:Location -Publisher $script:Publisher -Offer $script:Offer -Version $script:version -Sku $script:Sku
Remove-AzsPlatformImage -Publisher $script:Publisher -Offer $script:Offer -Version $script:version -Sku $script:Sku
}
#>
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$TestRecordingFile = Join-Path $PSScriptRoot 'VMExtension.Tests.Recording.json'
. (Join-Path $PSScriptRoot 'loadEnvJson.ps1')

$TestRecordingFile = Join-Path $PSScriptRoot 'Add-AzsVMExtension.Recording.json'
$currentPath = $PSScriptRoot
while(-not $mockingPath) {
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
Expand All @@ -11,7 +13,6 @@ $global:RunRaw = $RunRaw
$global:TestName = ""

Describe 'Get-AzsVMExtension' {
. $PSScriptRoot\Common.ps1

BeforeEach {

Expand Down Expand Up @@ -48,7 +49,7 @@ Describe 'Get-AzsVMExtension' {
It "TestListVMExtensions" -Skip:$('TestListVMExtensions' -in $global:SkippedTests) {
$global:TestName = 'TestListVMExtensions'

$VMExtensions = Get-AzsVMExtension -Location $global:Location
$VMExtensions = Get-AzsVMExtension
$VMExtensions | Should Not Be $null
foreach ($VMExtension in $VMExtensions) {
ValidateVMExtension -VMExtension $VMExtension
Expand All @@ -59,7 +60,7 @@ Describe 'Get-AzsVMExtension' {
It "TestGetVMExtension" -Skip:$('TestGetVMExtension' -in $global:SkippedTests) {
$global:TestName = 'TestGetVMExtension'

$VMExtensions = Get-AzsVMExtension -Location $global:Location
$VMExtensions = Get-AzsVMExtension
$VMExtensions | Should Not Be $null
foreach ($VMExtension in $VMExtensions) {
ValidateVMExtension -VMExtension $VMExtension
Expand All @@ -70,11 +71,10 @@ Describe 'Get-AzsVMExtension' {
It "TestGetAllVMExtensions" -Skip:$('TestGetAllVMExtensions' -in $global:SkippedTests) {
$global:TestName = 'TestGetAllVMExtensions'

$VMExtensions = Get-AzsVMExtension -Location $global:Location
$VMExtensions = Get-AzsVMExtension
$VMExtensions | Should Not Be $null
foreach ($VMExtension in $VMExtensions) {
$vmExt = Get-AzsVMExtension `
-Location $vmextension.Location `
-Publisher $vmExtension.Publisher `
-Type $vmExtension.ExtensionType `
-Version $vmExtension.TypeHandlerVersion `
Expand All @@ -88,7 +88,6 @@ Describe 'Get-AzsVMExtension' {
It "TestCreateVMExtension" -Skip:$('TestCreateVMExtension' -in $global:SkippedTests) {
$global:TestName = 'TestCreateVMExtension'
$result = Add-AzsVMExtension `
-Location $global:Location `
-Publisher "Microsoft" `
-Type "MicroExtension" `
-Version "0.1.0" `
Expand All @@ -102,7 +101,7 @@ Describe 'Get-AzsVMExtension' {

It "TestDeleteVMExtension" -Skip:$('TestDeleteVMExtension' -in $global:SkippedTests) {
$global:TestName = 'TestDeleteVMExtension'
Remove-AzsVMExtension -Location $global:Location -Publisher "Microsoft" -Type "MicroExtension" -Version "0.1.0"
Remove-AzsVMExtension -Publisher "Microsoft" -Type "MicroExtension" -Version "0.1.0"
}
}

Loading