13
13
# ----------------------------------------------------------------------------------
14
14
15
15
# Have to hard-code this because time keeps changing with every run and we cannot use recorded sessions
16
- $fixedStartDate = Get-Date - Date " 2016-03-21 12 :00:00"
16
+ $fixedStartDate = Get-Date - Date " 2016-04-12 22 :00:00"
17
17
$fixedStartDate = $fixedStartDate.ToUniversalTime ()
18
- $fixedEndDate = Get-Date - Date " 2016-03-22 12 :00:00"
18
+ $fixedEndDate = Get-Date - Date " 2016-04-13 20 :00:00"
19
19
$fixedEndDate = $fixedEndDate.ToUniversalTime ()
20
20
21
21
function SetVaultContext
22
22
{
23
- $vault = Get-AzureRmRecoveryServicesVault - ResourceGroupName " phaniktRSV " - Name " phaniktRs1 " ;
23
+ $vault = Get-AzureRmRecoveryServicesVault - ResourceGroupName " kazhengtest " - Name " pshtesting " ;
24
24
Set-AzureRmRecoveryServicesVaultContext - Vault $vault ;
25
25
}
26
26
27
27
function Test-GetJobsScenario
28
28
{
29
29
SetVaultContext;
30
- $jobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate
30
+ $jobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate
31
31
foreach ($job in $jobs )
32
32
{
33
33
Assert-NotNull $job.InstanceId
@@ -44,7 +44,7 @@ function Test-GetJobsTimeFilter
44
44
45
45
SetVaultContext;
46
46
47
- $filteredJobs = Get-AzureRmRecoveryServicesJob - From $startTime - To $endTime
47
+ $filteredJobs = Get-AzureRmRecoveryServicesBackupJob - From $startTime - To $endTime
48
48
49
49
# Adding a second here and there to make sure comparison works fine
50
50
$startTime.AddSeconds (-1 );
@@ -68,7 +68,7 @@ function Test-GetJobsStatusFilter
68
68
69
69
SetVaultContext;
70
70
71
- $filteredJobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate - Status $status ;
71
+ $filteredJobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate - Status $status ;
72
72
73
73
foreach ($job in $filteredJobs )
74
74
{
@@ -82,7 +82,7 @@ function Test-GetJobsOperationFilter
82
82
83
83
SetVaultContext;
84
84
85
- $filteredJobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate - Operation $operation ;
85
+ $filteredJobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate - Operation $operation ;
86
86
87
87
foreach ($job in $filteredJobs )
88
88
{
@@ -96,7 +96,7 @@ function Test-GetJobsBackupManagementTypeFilter
96
96
97
97
SetVaultContext;
98
98
99
- $filteredJobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate - BackupManagementType $type ;
99
+ $filteredJobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate - BackupManagementType $type ;
100
100
101
101
foreach ($job in $filteredJobs )
102
102
{
@@ -107,11 +107,11 @@ function Test-GetJobsBackupManagementTypeFilter
107
107
function Test-GetJobDetails
108
108
{
109
109
SetVaultContext;
110
- $jobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate
110
+ $jobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate
111
111
foreach ($job in $jobs )
112
112
{
113
- $jobDetails = Get-AzureRmRecoveryServicesJobDetails - Job $job ;
114
- $jobDetails2 = Get-AzureRmRecoveryServicesJobDetails - JobId $job.InstanceId
113
+ $jobDetails = Get-AzureRmRecoveryServicesBackupJob - Job $job ;
114
+ $jobDetails2 = Get-AzureRmRecoveryServicesBackupJob - JobId $job.InstanceId
115
115
116
116
Assert-AreEqual $jobDetails.InstanceId $job.InstanceId
117
117
Assert-AreEqual $jobDetails2.InstanceId $job.InstanceId
@@ -123,20 +123,20 @@ function Test-GetJobDetails
123
123
function Test-WaitJobScenario
124
124
{
125
125
SetVaultContext;
126
- $jobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate
126
+ $jobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate
127
127
foreach ($job in $jobs )
128
128
{
129
- $waitedJob = Wait-AzureRmRecoveryServicesJob - Job $job
129
+ $waitedJob = Wait-AzureRmRecoveryServicesBackupJob - Job $job
130
130
Assert-AreNotEqual $waitedJob.Status " InProgress"
131
131
Assert-AreNotEqual $waitedJob.Status " Cancelling"
132
132
}
133
- $waitedJobs = Wait-AzureRmRecoveryServicesJob - Job $jobs
133
+ $waitedJobs = Wait-AzureRmRecoveryServicesBackupJob - Job $jobs
134
134
}
135
135
136
136
function Test-WaitJobPipeScenario
137
137
{
138
138
SetVaultContext;
139
- $waitedJobs = Get-AzureRmRecoveryServicesJob - From $fixedStartDate - To $fixedEndDate | Wait-AzureRmRecoveryServicesJob
139
+ $waitedJobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate | Wait-AzureRmRecoveryServicesBackupJob
140
140
foreach ($waitedJob in $waitedJobs )
141
141
{
142
142
Assert-AreNotEqual $waitedJob.Status " InProgress"
@@ -146,18 +146,11 @@ function Test-WaitJobPipeScenario
146
146
147
147
function Test-CancelJobScenario
148
148
{
149
- $startTime = Get-Date - Date " 2016-04-10 21:00:00"
150
- $startTime = $startTime.ToUniversalTime ();
151
- $endTime = Get-Date - Date " 2016-04-11 21:00:00"
152
- $endTime = $endTime.ToUniversalTime ();
153
-
154
- $vault = Get-AzureRmRecoveryServicesVault - ResourceGroupName " kazhengtest" - Name " pshtesting" ;
155
- Set-AzureRmRecoveryServicesVaultContext - Vault $vault ;
156
-
157
- $runningJobs = Get-AzureRmRecoveryServicesJob - From $startTime - To $endTime - Status " InProgress" - Operation " Backup"
149
+ SetVaultContext;
150
+ $runningJobs = Get-AzureRmRecoveryServicesBackupJob - From $fixedStartDate - To $fixedEndDate - Status " InProgress" - Operation " Backup"
158
151
foreach ($runningJob in $runningJobs )
159
152
{
160
- $cancelledJob = Stop-AzureRmRecoveryServicesJob - Job $runningJob
153
+ $cancelledJob = Stop-AzureRmRecoveryServicesBackupJob - Job $runningJob
161
154
Assert-AreNotEqual $cancelledJob.Status " InProgress"
162
155
}
163
156
}
0 commit comments