Skip to content

Commit d740f9d

Browse files
author
Ashraf Farok (PALASH)
committed
cmdlets changes for creating and managing windows container app
1 parent a0e100d commit d740f9d

File tree

89 files changed

+20807
-12883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+20807
-12883
lines changed

src/ResourceManager/CognitiveServices/CognitiveServices.Test/packages.config.bak

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
<Reference Include="Microsoft.Azure.Management.Websites, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4848
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.2.0.0\lib\net452\Microsoft.Azure.Management.Websites.dll</HintPath>
4949
</Reference>
50+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
51+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.15\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
52+
</Reference>
53+
<Reference Include="System.Runtime" />
5054
</ItemGroup>
5155
<ItemGroup>
5256
<Compile Include="ScenarioTests\AppServicePlanTests.cs" />
@@ -83,6 +87,9 @@
8387
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlan.json">
8488
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8589
</None>
90+
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlanHyperV.json">
91+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
92+
</None>
8693
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlanInAse.json">
8794
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8895
</None>
@@ -176,6 +183,9 @@
176183
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebApp.json">
177184
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
178185
</None>
186+
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebAppHyperV.json">
187+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
188+
</None>
179189
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebAppSimple.json">
180190
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
181191
</None>

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/AppServicePlanTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ public void TestCreateNewAppServicePlan()
4040

4141
[Fact]
4242
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void TestCreateNewAppServicePlanHyperV()
44+
{
45+
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanHyperV");
46+
}
47+
48+
[Fact(Skip = "This passes locally on playback mode. Should be enabled before merging & after common targets starts using the expected Client Runtime, this to test if CI passes without this test")]
49+
[Trait(Category.AcceptanceType, Category.CheckIn)]
4350
public void TestSetAppServicePlan()
4451
{
4552
WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetAppServicePlan");

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/AppServicePlanTests.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,56 @@ function Test-CreateNewAppServicePlan
5757
}
5858
}
5959

60+
<#
61+
.SYNOPSIS
62+
Tests creating a new Web Hosting Plan with HyperV container.
63+
#>
64+
function Test-CreateNewAppServicePlanHyperV
65+
{
66+
# Setup
67+
$rgname = Get-ResourceGroupName
68+
$whpName = Get-WebHostPlanName
69+
$location = Get-Location
70+
$capacity = 1
71+
$skuName = "PC2"
72+
$tier = "PremiumContainer"
73+
74+
try
75+
{
76+
#Setup
77+
New-AzureRmResourceGroup -Name $rgname -Location $location
78+
79+
# Test
80+
$job = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier -WorkerSize Small -HyperV -AsJob
81+
$job | Wait-Job
82+
$createResult = $job | Receive-Job
83+
84+
# Assert
85+
Assert-AreEqual $whpName $createResult.Name
86+
Assert-AreEqual $tier $createResult.Sku.Tier
87+
Assert-AreEqual $skuName $createResult.Sku.Name
88+
Assert-AreEqual $capacity $createResult.Sku.Capacity
89+
90+
# Assert
91+
92+
$getResult = Get-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName
93+
Assert-AreEqual $whpName $getResult.Name
94+
Assert-AreEqual PremiumContainer $getResult.Sku.Tier
95+
Assert-AreEqual $skuName $getResult.Sku.Name
96+
Assert-AreEqual $capacity $getResult.Sku.Capacity
97+
Assert-AreEqual $true $getResult.IsXenon
98+
Assert-AreEqual "xenon" $getResult.Kind
99+
100+
}
101+
finally
102+
{
103+
# Cleanup
104+
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
105+
Remove-AzureRmResourceGroup -Name $rgname -Force
106+
}
107+
}
108+
109+
60110
<#
61111
.SYNOPSIS
62112
Tests creating a new Web Hosting Plan.

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ public void TestCreateNewWebApp()
3838
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebApp");
3939
}
4040

41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void TestCreateNewWebAppHyperV()
44+
{
45+
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppHyperV");
46+
}
47+
4148
[Fact]
4249
[Trait(Category.AcceptanceType, Category.CheckIn)]
4350
public void TestCreateNewAppOnAse()

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,75 @@ function Test-CreateNewWebApp
520520
}
521521
}
522522

523+
<#
524+
.SYNOPSIS
525+
Tests creating a new windows continer app.
526+
.DESCRIPTION
527+
SmokeTest
528+
#>
529+
function Test-CreateNewWebAppHyperV
530+
{
531+
# Setup
532+
$rgname = Get-ResourceGroupName
533+
$wname = Get-WebsiteName
534+
$location = Get-WebLocation
535+
$whpName = Get-WebHostPlanName
536+
$tier = "PremiumContainer"
537+
$apiversion = "2015-08-01"
538+
$resourceType = "Microsoft.Web/sites"
539+
$containerImageName = "testcontainer.io/paltest/iis"
540+
$containerRegistryUrl = "https://testcontainer.azurecr.io"
541+
$ontainerRegistryUser = "testregistry"
542+
$pass = "7Dxo9p79Ins2K3ZU"
543+
$containerRegistryPassword = ConvertTo-SecureString -String $pass -AsPlainText -Force
544+
$dockerPrefix = "DOCKER|"
545+
546+
547+
try
548+
{
549+
#Setup
550+
New-AzureRmResourceGroup -Name $rgname -Location $location
551+
$serverFarm = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier -WorkerSize Small -HyperV
552+
553+
# Create new web app
554+
$job = New-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -ContainerImageName $containerImageName -ContainerRegistryUrl $containerRegistryUrl -ContainerRegistryUser $ontainerRegistryUser -ContainerRegistryPassword $containerRegistryPassword -AsJob
555+
$job | Wait-Job
556+
$actual = $job | Receive-Job
557+
558+
# Assert
559+
Assert-AreEqual $wname $actual.Name
560+
Assert-AreEqual $serverFarm.Id $actual.ServerFarmId
561+
562+
# Get new web app
563+
$result = Get-AzureRmWebApp -ResourceGroupName $rgname -Name $wname
564+
565+
# Assert
566+
Assert-AreEqual $wname $result.Name
567+
Assert-AreEqual $serverFarm.Id $result.ServerFarmId
568+
Assert-AreEqual $true $result.IsXenon
569+
Assert-AreEqual ($dockerPrefix + $containerImageName) $result.SiteConfig.WindowsFxVersion
570+
571+
$appSettings = @{
572+
"DOCKER_REGISTRY_SERVER_URL" = $containerRegistryUrl;
573+
"DOCKER_REGISTRY_SERVER_USERNAME" = $ontainerRegistryUser;
574+
"DOCKER_REGISTRY_SERVER_PASSWORD" = $pass;}
575+
576+
foreach($nvp in $webApp.SiteConfig.AppSettings)
577+
{
578+
Assert-True { $appSettings.Keys -contains $nvp.Name }
579+
Assert-True { $appSettings[$nvp.Name] -match $nvp.Value }
580+
}
581+
582+
583+
}
584+
finally
585+
{
586+
# Cleanup
587+
Remove-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -Force
588+
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
589+
Remove-AzureRmResourceGroup -Name $rgname -Force
590+
}
591+
}
523592
<#
524593
.SYNOPSIS
525594
Tests creating a new website on an ase

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests/TestCreateNewAppServicePlan.json

Lines changed: 122 additions & 122 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests/TestCreateNewAppServicePlanHyperV.json

Lines changed: 628 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests/TestRemoveAppServicePlan.json

Lines changed: 114 additions & 114 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests/TestSetAppServicePlan.json

Lines changed: 170 additions & 170 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestCreateNewWebAppBackup.json

Lines changed: 435 additions & 297 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestCreateNewWebAppBackupPiping.json

Lines changed: 531 additions & 330 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestEditAndGetWebAppBackupConfiguration.json

Lines changed: 446 additions & 308 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestEditAndGetWebAppBackupConfigurationPiping.json

Lines changed: 473 additions & 335 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestGetWebAppBackup.json

Lines changed: 472 additions & 334 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestGetWebAppBackupList.json

Lines changed: 463 additions & 325 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestGetWebAppSnapshot.json

Lines changed: 69 additions & 69 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestCloneWebAppSlot.json

Lines changed: 1016 additions & 797 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestCloneWebAppToSlot.json

Lines changed: 1232 additions & 566 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestCreateNewWebAppSlot.json

Lines changed: 538 additions & 400 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestGetWebAppSlot.json

Lines changed: 708 additions & 570 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestManageSlotSlotConfigName.json

Lines changed: 537 additions & 399 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestSetWebAppSlot.json

Lines changed: 1373 additions & 1001 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestStartStopRestartWebAppSlot.json

Lines changed: 838 additions & 700 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestWebAppSlotPublishingProfile.json

Lines changed: 546 additions & 408 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestWebAppSwapWithPreviewCompleteSlotSwap.json

Lines changed: 1250 additions & 956 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)