Skip to content

Commit 3a2c7f8

Browse files
authored
Merge pull request #5996 from Nking92/mergedpreview
Websites: Add new snapshots cmdlets
2 parents 5098317 + 26312e5 commit 3a2c7f8

File tree

16 files changed

+10792
-18322
lines changed

16 files changed

+10792
-18322
lines changed

src/ResourceManager/Websites/AzureRM.Websites.Netcore.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ CmdletsToExport = 'Get-AzureRmAppServicePlan', 'Set-AzureRmAppServicePlan',
9393
'New-AzureRmWebAppBackup', 'Remove-AzureRmWebApp',
9494
'New-AzureRmWebApp', 'Remove-AzureRmWebAppBackup',
9595
'Reset-AzureRmWebAppPublishingProfile', 'Restart-AzureRmWebApp',
96-
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp'
96+
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp',
97+
'Get-AzureRmWebAppSnapshots', 'Restore-AzureRmWebAppSnapshot'
9798

9899
# Variables to export from this module
99100
# VariablesToExport = @()

src/ResourceManager/Websites/AzureRM.Websites.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ CmdletsToExport = 'Get-AzureRmAppServicePlan', 'Set-AzureRmAppServicePlan',
9494
'New-AzureRmWebAppBackup', 'Remove-AzureRmWebApp',
9595
'New-AzureRmWebApp', 'Remove-AzureRmWebAppBackup',
9696
'Reset-AzureRmWebAppPublishingProfile', 'Restart-AzureRmWebApp',
97-
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp'
97+
'Set-AzureRmWebApp', 'Start-AzureRmWebApp', 'Stop-AzureRmWebApp',
98+
'Get-AzureRmWebAppSnapshot', 'Restore-AzureRmWebAppSnapshot'
9899

99100
# Variables to export from this module
100101
# VariablesToExport = @()

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppBackupList.json">
215215
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
216216
</None>
217-
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppSnapshots.json">
217+
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppSnapshot.json">
218218
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
219219
</None>
220220
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestRestoreWebAppSnapshot.json">
@@ -244,6 +244,12 @@
244244
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestWebAppSlotPublishingProfile.json">
245245
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
246246
</None>
247+
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestWebAppSwapWithPreviewResetSlotSwap.json">
248+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
249+
</None>
250+
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestWebAppSwapWithPreviewCompleteSlotSwap.json">
251+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
252+
</None>
247253
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCloneNewWebApp.json">
248254
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
249255
</None>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,19 @@ public void TestEditAndGetWebAppBackupConfigurationPiping()
6868
{
6969
WebsitesController.NewInstance.RunPsTest("Test-EditAndGetWebAppBackupConfigurationPiping");
7070
}
71+
72+
[Fact]
73+
[Trait(Category.AcceptanceType, Category.CheckIn)]
74+
public void TestGetWebAppSnapshot()
75+
{
76+
WebsitesController.NewInstance.RunPsTest("Test-GetWebAppSnapshot");
77+
}
78+
79+
[Fact]
80+
[Trait(Category.AcceptanceType, Category.CheckIn)]
81+
public void TestRestoreWebAppSnapshot()
82+
{
83+
WebsitesController.NewInstance.RunPsTest("Test-RestoreWebAppSnapshot");
84+
}
7185
}
7286
}

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ function Test-EditAndGetWebAppBackupConfigurationPiping
328328
}
329329
}
330330

331-
function Test-GetWebAppSnapshots
331+
function Test-GetWebAppSnapshot
332332
{
333333
# Test named parameters
334334
$snapshots = Get-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName
@@ -364,17 +364,13 @@ function Test-RestoreWebAppSnapshot
364364
{
365365
# Test overwrite
366366
$snapshot = (Get-AzureRmWebAppSnapshot $snapshotRgName $snapshotAppName)[0]
367-
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -SnapshotTime $snapshot.SnapshotTime -Force -RecoverConfiguration
367+
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -InputObject $snapshot -Force -RecoverConfiguration
368368

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

373-
# Test piping
374-
$snapshot | Restore-AzureRmWebAppSnapshot -Force
375-
376-
# Test background job
377-
$snapshot | Restore-AzureRmWebAppSnapshot -Force -AsJob
372+
# Test piping and background job
373+
$job = $snapshot | Restore-AzureRmWebAppSnapshot -Force -AsJob
378374
$job | Wait-Job
379375
}
380376

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,15 @@ public void TestWebAppRegularSlotSwap()
106106
WebsitesController.NewInstance.RunPsTest("Test-WebAppRegularSlotSwap");
107107
}
108108

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

116-
[Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")]
116+
[Fact]
117117
[Trait(Category.AcceptanceType, Category.CheckIn)]
118-
[Trait("Re-record", "ClientRuntime changes")]
119118
public void TestWebAppSwapWithPreviewCompleteSlotSwap()
120119
{
121120
WebsitesController.NewInstance.RunPsTest("Test-WebAppSwapWithPreviewCompleteSlotSwap");

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,17 @@ function Test-SlotSwapWithPreview($swapWithPreviewAction)
889889
Switch-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -SourceSlotName $sourceSlotName -DestinationSlotName $destinationSlotName -SwapWithPreviewAction 'ApplySlotConfig'
890890
Wait-Seconds 30
891891
$sourceWebApp = Get-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $sourceSlotName
892-
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalDestinationAppSettingValue
892+
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalSourceAppSettingValue
893893

894894
# Let's finish the current slot swap operation (complete or reset)
895895
Switch-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -SourceSlotName $sourceSlotName -DestinationSlotName $destinationSlotName -SwapWithPreviewAction $swapWithPreviewAction
896896
Wait-Seconds 30
897897
$sourceWebApp = Get-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $sourceSlotName
898-
#Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalSourceAppSettingValue
898+
If ($swapWithPreviewAction -eq 'ResetSlotSwap') {
899+
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalSourceAppSettingValue
900+
} Else {
901+
Validate-SlotSwapAppSetting $sourceWebApp $appSettingName $originalDestinationAppSettingValue
902+
}
899903
}
900904
finally
901905
{

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

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

0 commit comments

Comments
 (0)