Skip to content

Commit

Permalink
Fixed TestCases
Browse files Browse the repository at this point in the history
  • Loading branch information
hiaga committed May 18, 2021
1 parent 61c1cfd commit 3af6899
Show file tree
Hide file tree
Showing 32 changed files with 60,689 additions and 36,746 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class ProtectionCheckTests : RMTestBase
{
[Fact]
[Fact(Skip = "To un-skip in upcoming release")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSProtectionCheck()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function Test-AzureVMGetContainers
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
Enable-Protection $vault $vm

# VARIATION-1: Get All Containers with only mandatory parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function Test-AzureVMGetItems
$vm = Create-VM $resourceGroupName $location 1
$vm2 = Create-VM $resourceGroupName $location 12
$vault = Create-RecoveryServicesVault $resourceGroupName $location

# disable soft delete for successful cleanup
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"

Enable-Protection $vault $vm
Enable-Protection $vault $vm2
$policy = Get-AzRecoveryServicesBackupProtectionPolicy `
Expand Down Expand Up @@ -215,7 +219,7 @@ function Test-AzureVMProtection
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location

Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
# Sleep to give the service time to add the default policy to the vault
Start-TestSleep 5000

Expand Down Expand Up @@ -278,6 +282,7 @@ function Test-AzureVMGetRPs
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
$item = Enable-Protection $vault $vm
$backupJob = Backup-Item $vault $item

Expand Down Expand Up @@ -345,6 +350,7 @@ function Test-AzureVMFullRestore
$saName = Create-SA $resourceGroupName $location
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
$item = Enable-Protection $vault $vm
$backupJob = Backup-Item $vault $item
$rp = Get-RecoveryPoint $vault $item $backupJob
Expand Down Expand Up @@ -398,7 +404,6 @@ function Test-AzureUnmanagedVMFullRestore
$saName = Create-SA $resourceGroupName $location
$vm = Create-UnmanagedVM $resourceGroupName $location $saName
$vault = Create-RecoveryServicesVault $resourceGroupName $location

Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
$VaultProperty = Get-AzRecoveryServicesVaultProperty -VaultId $vault.ID
Assert-True { $VaultProperty.SoftDeleteFeatureState -eq "Disabled" }
Expand Down Expand Up @@ -441,6 +446,7 @@ function Test-AzureVMRPMountScript
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
$item = Enable-Protection $vault $vm
$backupJob = Backup-Item $vault $item
$rp = Get-RecoveryPoint $vault $item $backupJob
Expand Down Expand Up @@ -476,6 +482,7 @@ function Test-AzureVMBackup
{
# Setup
$vault = Create-RecoveryServicesVault $resourceGroupName $location
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"
$vm = Create-VM $resourceGroupName $location
$item = Enable-Protection $vault $vm

Expand Down Expand Up @@ -504,10 +511,13 @@ function Test-AzureVMSetVaultContext
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location

# disable soft delete for successful cleanup
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"

# Sleep to give the service time to add the default policy to the vault
Start-TestSleep 5000

Set-AzRecoveryServicesVaultContext -Vault $vault
Set-AzRecoveryServicesVaultContext -Vault $vault | Out-Null

# Get default policy
$policy = Get-AzRecoveryServicesBackupProtectionPolicy `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ function Test-AzureVMGetJobsTimeFilter
$vm1 = Create-VM $resourceGroupName $location 1
$vm2 = Create-VM $resourceGroupName $location 2
$vault = Create-RecoveryServicesVault $resourceGroupName $location

# Disable soft Delete
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"

Enable-Protection $vault $vm1
Enable-Protection $vault $vm2

Expand Down Expand Up @@ -142,16 +146,7 @@ function Test-AzureVMGetJobsTimeFilter
-To $endTime2 } `
"Please specify From and To filter values in UTC. Other timezones are not supported";

# 3. rangeEnd.Subtract(rangeStart) > TimeSpan.FromDays(30)
$startTime3 = Get-QueryDateInUtc $((Get-Date).AddDays(-40)) "StartTime3"
$endTime3 = Get-QueryDateInUtc $(Get-Date) "EndTime3"
Assert-ThrowsContains { Get-AzRecoveryServicesBackupJob `
-VaultId $vault.ID `
-From $startTime3 `
-To $endTime3 } `
"To filter should not be more than 30 days away from From filter";

# 4. rangeStart > DateTime.UtcNow
# 3. rangeStart > DateTime.UtcNow
$startTime4 = Get-QueryDateInUtc $((Get-Date).AddYears(100).AddDays(-1)) "StartTime4"
$endTime4 = Get-QueryDateInUtc $((Get-Date).AddYears(100)) "EndTime4"
Assert-ThrowsContains { Get-AzRecoveryServicesBackupJob `
Expand All @@ -177,6 +172,10 @@ function Test-AzureVMWaitJob
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location

# Disable soft Delete
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"

$item = Enable-Protection $vault $vm

$backupJob = Backup-AzRecoveryServicesBackupItem -VaultId $vault.ID -Item $item
Expand Down Expand Up @@ -204,6 +203,10 @@ function Test-AzureVMCancelJob
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location

# Disable soft Delete
Set-AzRecoveryServicesVaultProperty -VaultId $vault.ID -SoftDeleteFeatureState "Disable"

$item = Enable-Protection $vault $vm

$backupJob = Backup-AzRecoveryServicesBackupItem -VaultId $vault.ID -Item $item
Expand Down
Loading

0 comments on commit 3af6899

Please sign in to comment.