Skip to content

Commit

Permalink
Merge branch 'preview' into ifdef-tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
MiYanni authored Nov 27, 2018
2 parents b0f1c49 + 4d8e174 commit 55900e5
Show file tree
Hide file tree
Showing 24 changed files with 10,184 additions and 1,225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,7 @@
"Get-AzWebAppContainerContinuousDeploymentUrl": "Get-AzureRmWebAppContainerContinuousDeploymentUrl",
"Enter-AzWebAppContainerPSSession": "Enter-AzureRmWebAppContainerPSSession",
"New-AzWebAppContainerPSSession": "New-AzureRmWebAppContainerPSSession",
"Swap-AzWebAppSlot": "Swap-AzureRmWebAppSlot"
"Swap-AzWebAppSlot": "Swap-AzureRmWebAppSlot",
"New-AzWebAppAzureStoragePath": "New-AzureRmWebAppAzureStoragePath"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestManageSlotSlotConfigName.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestSetAzureStorageWebAppHyperVSlot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestSetWebAppSlot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -194,6 +197,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestRemoveWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestSetAzureStorageWebAppHyperV.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestSetWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,12 @@ public void TestWebAppSwapWithPreviewCompleteSlotSwap()
{
WebsitesController.NewInstance.RunPsTest(_logger, "Test-WebAppSwapWithPreviewCompleteSlotSwap");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetAzureStorageWebAppHyperVSlot()
{
WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetAzureStorageWebAppHyperVSlot");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,152 @@ function Test-SlotSwapWithPreview($swapWithPreviewAction)

}

<#
.SYNOPSIS
Tests setting and Azure Storage Account in a new Windows container app. Currently the API fails when adding Azure Storage Accounts for slots. Will enable this test when the API is fixed.
.DESCRIPTION
SmokeTest
#>
function Test-SetAzureStorageWebAppHyperVSlot
{
# Setup
$rgname = Get-ResourceGroupName
$wname = Get-WebsiteName
$slotname = "staging"
$location = Get-WebLocation
$whpName = Get-WebHostPlanName
$tier = "PremiumContainer"
$apiversion = "2015-08-01"
$resourceType = "Microsoft.Web/sites"
$containerImageName = "testcontainer.io/test/iis"
$containerRegistryUrl = "https://testcontainer.azurecr.io"
$ontainerRegistryUser = "testregistry"
$pass = "7Dxo9p79Ins2K3ZU"
$containerRegistryPassword = ConvertTo-SecureString -String $pass -AsPlainText -Force
$dockerPrefix = "DOCKER|"
$azureStorageAccountCustomId1 = "mystorageaccount"
$azureStorageAccountType1 = "AzureFiles"
$azureStorageAccountName1 = "myaccountname.file.core.windows.net"
$azureStorageAccountShareName1 = "myremoteshare"
$azureStorageAccountAccessKey1 = "AnAccessKey"
$azureStorageAccountMountPath1 = "C:\mymountpath"
$azureStorageAccountCustomId2 = "mystorageaccount2"
$azureStorageAccountType2 = "AzureFiles"
$azureStorageAccountName2 = "myaccountname2.file.core.windows.net"
$azureStorageAccountShareName2 = "myremoteshare2"
$azureStorageAccountAccessKey2 = "AnAccessKey2"
$azureStorageAccountMountPath2 = "C:\mymountpath2"

try
{
###
# Currently the API fails when adding Azure Storage Accounts for slots. Will enable this test when the API is fixed.
###

#Setup
New-AzureRmResourceGroup -Name $rgname -Location $location
$serverFarm = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier -WorkerSize Small -HyperV

# Create new web app
$job = New-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -ContainerImageName $containerImageName -ContainerRegistryUrl $containerRegistryUrl -ContainerRegistryUser $ontainerRegistryUser -ContainerRegistryPassword $containerRegistryPassword -AsJob
$job | Wait-Job
$actual = $job | Receive-Job

# Assert
Assert-AreEqual $wname $actual.Name
Assert-AreEqual $serverFarm.Id $actual.ServerFarmId

# Get new web app
$result = Get-AzureRmWebApp -ResourceGroupName $rgname -Name $wname

Write-Debug "Created the web app"

# Assert
Assert-AreEqual $wname $result.Name
Assert-AreEqual $serverFarm.Id $result.ServerFarmId
Assert-AreEqual $true $result.IsXenon
Assert-AreEqual ($dockerPrefix + $containerImageName) $result.SiteConfig.WindowsFxVersion

# Create deployment slot
$job = New-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $wname -Slot $slotname -AsJob
$job | Wait-Job
$slot1 = $job | Receive-Job

Write-Debug "Created the slot"

$appWithSlotName = "$wname/$slotname"

Write-Debug $appWithSlotName

# Assert
Assert-AreEqual $appWithSlotName $slot1.Name
Assert-AreEqual $serverFarm.Id $slot1.ServerFarmId

$testStorageAccount1 = New-AzureRmWebAppAzureStoragePath -Name $azureStorageAccountCustomId1 -Type $azureStorageAccountType1 -AccountName $azureStorageAccountName1 -ShareName $azureStorageAccountShareName1 -AccessKey $azureStorageAccountAccessKey1 -MountPath $azureStorageAccountMountPath1
$testStorageAccount2 = New-AzureRmWebAppAzureStoragePath -Name $azureStorageAccountCustomId2 -Type $azureStorageAccountType2 -AccountName $azureStorageAccountName2 -ShareName $azureStorageAccountShareName2 -AccessKey $azureStorageAccountAccessKey2 -MountPath $azureStorageAccountMountPath2

Write-Debug "Created the new storage account paths"

Write-Debug $testStorageAccount1.Name
Write-Debug $testStorageAccount2.Name


# set Azure Storage accounts
$webApp = Set-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $wname -Slot $slotname -AzureStoragePath $testStorageAccount1, $testStorageAccount2

Write-Debug "Set the new storage account paths"


# get the web app
$result = Get-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $wname -Slot $slotname
$azureStorageAccounts = $result.AzureStoragePath

# Assert
Write-Debug $azureStorageAccounts[0].Name
Assert-AreEqual $azureStorageAccounts[0].Name $azureStorageAccountCustomId1

Write-Debug $azureStorageAccounts[0].Type
Assert-AreEqual $azureStorageAccounts[0].Type $azureStorageAccountType1

Write-Debug $azureStorageAccounts[0].AccountName
Assert-AreEqual $azureStorageAccounts[0].AccountName $azureStorageAccountName1

Write-Debug $azureStorageAccounts[0].ShareName
Assert-AreEqual $azureStorageAccounts[0].ShareName $azureStorageAccountShareName1

Write-Debug $azureStorageAccounts[0].AccessKey
Assert-AreEqual $azureStorageAccounts[0].AccessKey $azureStorageAccountAccessKey1

Write-Debug $azureStorageAccounts[0].MountPath
Assert-AreEqual $azureStorageAccounts[0].MountPath $azureStorageAccountMountPath1

Write-Debug $azureStorageAccounts[1].Name
Assert-AreEqual $azureStorageAccounts[1].Name $azureStorageAccountCustomId2

Write-Debug $azureStorageAccounts[1].Type
Assert-AreEqual $azureStorageAccounts[1].Type $azureStorageAccountType2

Write-Debug $azureStorageAccounts[1].AccountName
Assert-AreEqual $azureStorageAccounts[1].AccountName $azureStorageAccountName2

Write-Debug $azureStorageAccounts[1].ShareName
Assert-AreEqual $azureStorageAccounts[1].ShareName $azureStorageAccountShareName2

Write-Debug $azureStorageAccounts[1].AccessKey
Assert-AreEqual $azureStorageAccounts[1].AccessKey $azureStorageAccountAccessKey2

Write-Debug $azureStorageAccounts[1].MountPath
Assert-AreEqual $azureStorageAccounts[1].MountPath $azureStorageAccountMountPath2
}
finally
{
# Cleanup
Remove-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -Force
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
Remove-AzureRmResourceGroup -Name $rgname -Force
}
}

<#
.SYNOPSIS
Validates slot app setting for slot swap tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public void TestEnableContainerContinuousDeploymentAndGetUrl()
WebsitesController.NewInstance.RunPsTest(_logger, "Test-EnableContainerContinuousDeploymentAndGetUrl");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetAzureStorageWebAppHyperV()
{
WebsitesController.NewInstance.RunPsTest(_logger, "Test-SetAzureStorageWebAppHyperV");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewAppOnAse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,130 @@ function Test-WindowsContainerWebAppPSSessionOpened
}
}

<#
.SYNOPSIS
Tests setting and Azure Storage Account in a new Windows container app.
.DESCRIPTION
SmokeTest
#>
function Test-SetAzureStorageWebAppHyperV
{
# Setup
$rgname = Get-ResourceGroupName
$wname = Get-WebsiteName
$location = Get-WebLocation
$whpName = Get-WebHostPlanName
$tier = "PremiumContainer"
$apiversion = "2015-08-01"
$resourceType = "Microsoft.Web/sites"
$containerImageName = "testcontainer.io/test/iis"
$containerRegistryUrl = "https://testcontainer.azurecr.io"
$ontainerRegistryUser = "testregistry"
$pass = "7Dxo9p79Ins2K3ZU"
$containerRegistryPassword = ConvertTo-SecureString -String $pass -AsPlainText -Force
$dockerPrefix = "DOCKER|"
$azureStorageAccountCustomId1 = "mystorageaccount"
$azureStorageAccountType1 = "AzureFiles"
$azureStorageAccountName1 = "myaccountname.file.core.windows.net"
$azureStorageAccountShareName1 = "myremoteshare"
$azureStorageAccountAccessKey1 = "AnAccessKey"
$azureStorageAccountMountPath1 = "C:\mymountpath"
$azureStorageAccountCustomId2 = "mystorageaccount2"
$azureStorageAccountType2 = "AzureFiles"
$azureStorageAccountName2 = "myaccountname2.file.core.windows.net"
$azureStorageAccountShareName2 = "myremoteshare2"
$azureStorageAccountAccessKey2 = "AnAccessKey2"
$azureStorageAccountMountPath2 = "C:\mymountpath2"

try
{
#Setup
New-AzureRmResourceGroup -Name $rgname -Location $location
$serverFarm = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier -WorkerSize Small -HyperV

# Create new web app
$job = New-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -ContainerImageName $containerImageName -ContainerRegistryUrl $containerRegistryUrl -ContainerRegistryUser $ontainerRegistryUser -ContainerRegistryPassword $containerRegistryPassword -AsJob
$job | Wait-Job
$actual = $job | Receive-Job

# Assert
Assert-AreEqual $wname $actual.Name
Assert-AreEqual $serverFarm.Id $actual.ServerFarmId

# Get new web app
$result = Get-AzureRmWebApp -ResourceGroupName $rgname -Name $wname

# Assert
Assert-AreEqual $wname $result.Name
Assert-AreEqual $serverFarm.Id $result.ServerFarmId
Assert-AreEqual $true $result.IsXenon
Assert-AreEqual ($dockerPrefix + $containerImageName) $result.SiteConfig.WindowsFxVersion

$testStorageAccount1 = New-AzureRmWebAppAzureStoragePath -Name $azureStorageAccountCustomId1 -Type $azureStorageAccountType1 -AccountName $azureStorageAccountName1 -ShareName $azureStorageAccountShareName1 -AccessKey $azureStorageAccountAccessKey1 -MountPath $azureStorageAccountMountPath1
$testStorageAccount2 = New-AzureRmWebAppAzureStoragePath -Name $azureStorageAccountCustomId2 -Type $azureStorageAccountType2 -AccountName $azureStorageAccountName2 -ShareName $azureStorageAccountShareName2 -AccessKey $azureStorageAccountAccessKey2 -MountPath $azureStorageAccountMountPath2

Write-Debug "Created the new storage account paths"

Write-Debug $testStorageAccount1.Name
Write-Debug $testStorageAccount2.Name


# set Azure Storage accounts
$webApp = Set-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -AzureStoragePath $testStorageAccount1, $testStorageAccount2

Write-Debug "Set the new storage account paths"


# get the web app
$result = Get-AzureRmWebApp -ResourceGroupName $rgname -Name $wname
$azureStorageAccounts = $result.AzureStoragePath

# Assert
Write-Debug $azureStorageAccounts[0].Name
Assert-AreEqual $azureStorageAccounts[0].Name $azureStorageAccountCustomId1

Write-Debug $azureStorageAccounts[0].Type
Assert-AreEqual $azureStorageAccounts[0].Type $azureStorageAccountType1

Write-Debug $azureStorageAccounts[0].AccountName
Assert-AreEqual $azureStorageAccounts[0].AccountName $azureStorageAccountName1

Write-Debug $azureStorageAccounts[0].ShareName
Assert-AreEqual $azureStorageAccounts[0].ShareName $azureStorageAccountShareName1

Write-Debug $azureStorageAccounts[0].AccessKey
Assert-AreEqual $azureStorageAccounts[0].AccessKey $azureStorageAccountAccessKey1

Write-Debug $azureStorageAccounts[0].MountPath
Assert-AreEqual $azureStorageAccounts[0].MountPath $azureStorageAccountMountPath1

Write-Debug $azureStorageAccounts[1].Name
Assert-AreEqual $azureStorageAccounts[1].Name $azureStorageAccountCustomId2

Write-Debug $azureStorageAccounts[1].Type
Assert-AreEqual $azureStorageAccounts[1].Type $azureStorageAccountType2

Write-Debug $azureStorageAccounts[1].AccountName
Assert-AreEqual $azureStorageAccounts[1].AccountName $azureStorageAccountName2

Write-Debug $azureStorageAccounts[1].ShareName
Assert-AreEqual $azureStorageAccounts[1].ShareName $azureStorageAccountShareName2

Write-Debug $azureStorageAccounts[1].AccessKey
Assert-AreEqual $azureStorageAccounts[1].AccessKey $azureStorageAccountAccessKey2

Write-Debug $azureStorageAccounts[1].MountPath
Assert-AreEqual $azureStorageAccounts[1].MountPath $azureStorageAccountMountPath2
}
finally
{
# Cleanup
Remove-AzureRmWebApp -ResourceGroupName $rgname -Name $wname -Force
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
Remove-AzureRmResourceGroup -Name $rgname -Force
}
}

<#
.SYNOPSIS
Tests creating a new website on an ase
Expand Down Expand Up @@ -1005,7 +1129,8 @@ function Test-SetWebApp

# Create new web app
$webApp = New-AzureRmWebApp -ResourceGroupName $rgname -Name $webAppName -Location $location -AppServicePlan $appServicePlanName1

Write-Debug "DEBUG: Created the Web App"

# Assert
Assert-AreEqual $webAppName $webApp.Name
Assert-AreEqual $serverFarm1.Id $webApp.ServerFarmId
Expand All @@ -1017,6 +1142,8 @@ function Test-SetWebApp
$job | Wait-Job
$webApp = $job | Receive-Job

Write-Debug "DEBUG: Changed service plan"

# Assert
Assert-AreEqual $webAppName $webApp.Name
Assert-AreEqual $serverFarm2.Id $webApp.ServerFarmId
Expand All @@ -1029,6 +1156,8 @@ function Test-SetWebApp
# Set site properties
$webApp = $webApp | Set-AzureRmWebApp

Write-Debug "DEBUG: Changed site properties"

# Assert
Assert-AreEqual $webAppName $webApp.Name
Assert-AreEqual $serverFarm2.Id $webApp.ServerFarmId
Expand Down
Loading

0 comments on commit 55900e5

Please sign in to comment.