Skip to content

Websites: Add new snapshots cmdlets #5996

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

Merged
merged 5 commits into from
Apr 28, 2018
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
3 changes: 2 additions & 1 deletion src/ResourceManager/Websites/AzureRM.Websites.Netcore.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ CmdletsToExport = 'Get-AzureRmAppServicePlan', 'Set-AzureRmAppServicePlan',
'New-AzureRmWebAppBackup', 'Remove-AzureRmWebApp',
'New-AzureRmWebApp', 'Remove-AzureRmWebAppBackup',
'Reset-AzureRmWebAppPublishingProfile', 'Restart-AzureRmWebApp',
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp'
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp',
'Get-AzureRmWebAppSnapshots', 'Restore-AzureRmWebAppSnapshot'

# Variables to export from this module
# VariablesToExport = @()
Expand Down
3 changes: 2 additions & 1 deletion src/ResourceManager/Websites/AzureRM.Websites.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ CmdletsToExport = 'Get-AzureRmAppServicePlan', 'Set-AzureRmAppServicePlan',
'New-AzureRmWebAppBackup', 'Remove-AzureRmWebApp',
'New-AzureRmWebApp', 'Remove-AzureRmWebAppBackup',
'Reset-AzureRmWebAppPublishingProfile', 'Restart-AzureRmWebApp',
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp'
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp',
'Get-AzureRmWebAppSnapshot', 'Restore-AzureRmWebAppSnapshot'

# Variables to export from this module
# VariablesToExport = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppBackupList.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppSnapshots.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppSnapshot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestRestoreWebAppSnapshot.json">
Expand Down Expand Up @@ -244,6 +244,12 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestWebAppSlotPublishingProfile.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestWebAppSwapWithPreviewResetSlotSwap.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestWebAppSwapWithPreviewCompleteSlotSwap.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCloneNewWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -300,7 +306,6 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
Copy link
Member

@markcowl markcowl Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add your new recorded mock files here and ensure they are set to CopyAlways

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason for the ci failure

<ItemGroup />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Import Project="..\..\..\..\tools\Common.Dependencies.Test.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,19 @@ public void TestEditAndGetWebAppBackupConfigurationPiping()
{
WebsitesController.NewInstance.RunPsTest("Test-EditAndGetWebAppBackupConfigurationPiping");
}

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRestoreWebAppSnapshot()
{
WebsitesController.NewInstance.RunPsTest("Test-RestoreWebAppSnapshot");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function Test-EditAndGetWebAppBackupConfigurationPiping
}
}

function Test-GetWebAppSnapshots
function Test-GetWebAppSnapshot
{
# Test named parameters
$snapshots = Get-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName
Expand Down Expand Up @@ -364,17 +364,13 @@ function Test-RestoreWebAppSnapshot
{
# Test overwrite
$snapshot = (Get-AzureRmWebAppSnapshot $snapshotRgName $snapshotAppName)[0]
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -SnapshotTime $snapshot.SnapshotTime -Force -RecoverConfiguration
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -InputObject $snapshot -Force -RecoverConfiguration

# Test restore to target slot
$target = Get-AzureRmWebAppSlot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -Slot $snapshotAppSlot
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -SnapshotTime $snapshot.SnapshotTime -RecoverConfiguration -TargetApp $target
Restore-AzureRmWebAppSnapshot $snapshotRgName $snapshotAppName $snapshotAppSlot $snapshot -RecoverConfiguration -Force

# Test piping
$snapshot | Restore-AzureRmWebAppSnapshot -Force

# Test background job
$snapshot | Restore-AzureRmWebAppSnapshot -Force -AsJob
# Test piping and background job
$job = $snapshot | Restore-AzureRmWebAppSnapshot -Force -AsJob
$job | Wait-Job
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,15 @@ public void TestWebAppRegularSlotSwap()
WebsitesController.NewInstance.RunPsTest("Test-WebAppRegularSlotSwap");
}

[Fact(Skip = "iss#6044 The test needs to be re-written")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestWebAppSwapWithPreviewResetSlotSwap()
{
WebsitesController.NewInstance.RunPsTest("Test-WebAppSwapWithPreviewResetSlotSwap");
}

[Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait("Re-record", "ClientRuntime changes")]
public void TestWebAppSwapWithPreviewCompleteSlotSwap()
{
WebsitesController.NewInstance.RunPsTest("Test-WebAppSwapWithPreviewCompleteSlotSwap");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,17 @@ function Test-SlotSwapWithPreview($swapWithPreviewAction)
Switch-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -SourceSlotName $sourceSlotName -DestinationSlotName $destinationSlotName -SwapWithPreviewAction 'ApplySlotConfig'
Wait-Seconds 30
$sourceWebApp = Get-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $sourceSlotName
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalDestinationAppSettingValue
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalSourceAppSettingValue

# Let's finish the current slot swap operation (complete or reset)
Switch-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -SourceSlotName $sourceSlotName -DestinationSlotName $destinationSlotName -SwapWithPreviewAction $swapWithPreviewAction
Wait-Seconds 30
$sourceWebApp = Get-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $sourceSlotName
#Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalSourceAppSettingValue
If ($swapWithPreviewAction -eq 'ResetSlotSwap') {
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalSourceAppSettingValue
} Else {
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalDestinationAppSettingValue
}
}
finally
{
Expand Down

Large diffs are not rendered by default.

Loading