@@ -28,7 +28,7 @@ Tests creating new Batch account.
28
28
function Test-CreatesNewBatchAccount
29
29
{
30
30
# Setup
31
- $account = Get-BatchAccountName
31
+ $account = Get-BatchAccountName
32
32
$resourceGroup = Get-ResourceGroupName
33
33
$location = Get-BatchAccountProviderLocation
34
34
@@ -41,11 +41,14 @@ function Test-CreatesNewBatchAccount
41
41
$expected = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
42
42
43
43
# Assert
44
- Assert-AreEqual $expected.AccountName $actual.AccountName
44
+ Assert-AreEqual $expected.AccountName $actual.AccountName
45
45
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
46
- Assert-AreEqual $expected.Location $actual.Location
46
+ Assert-AreEqual $expected.Location $actual.Location
47
47
Assert-AreEqual $expected.Tags [0 ][" Name" ] $actual.Tags [0 ][" Name" ]
48
- Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
48
+ Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
49
+ Assert-True { $actual.CoreQuota -gt 0 }
50
+ Assert-True { $actual.PoolQuota -gt 0 }
51
+ Assert-True { $actual.ActiveJobAndJobScheduleQuota -gt 0 }
49
52
}
50
53
finally
51
54
{
@@ -61,7 +64,7 @@ Tests creating an account that already exists throws
61
64
function Test-CreateExistingBatchAccount
62
65
{
63
66
# Setup
64
- $account = Get-BatchAccountName
67
+ $account = Get-BatchAccountName
65
68
$resourceGroup = Get-ResourceGroupName
66
69
$location = Get-BatchAccountProviderLocation
67
70
@@ -88,36 +91,36 @@ Tests updating existing Batch account
88
91
function Test-UpdatesExistingBatchAccount
89
92
{
90
93
# Setup
91
- $account = Get-BatchAccountName
94
+ $account = Get-BatchAccountName
92
95
$resourceGroup = Get-ResourceGroupName
93
96
$location = Get-BatchAccountProviderLocation
94
97
95
- $tagName1 = " testtag1"
96
- $tagValue1 = " testval1"
97
- $tagName2 = " testtag2"
98
- $tagValue2 = " testval2"
98
+ $tagName1 = " testtag1"
99
+ $tagValue1 = " testval1"
100
+ $tagName2 = " testtag2"
101
+ $tagValue2 = " testval2"
99
102
100
103
try
101
104
{
102
105
New-AzureRmResourceGroup - Name $resourceGroup - Location $location
103
106
104
- # Test
107
+ # Test
105
108
$new = New-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup - Location $location - Tag @ {Name = $tagName1 ; Value = $tagValue1 }
106
- Assert-AreEqual 1 $new.Tags.Count
109
+ Assert-AreEqual 1 $new.Tags.Count
107
110
108
- # Update Tag
111
+ # Update Tag
109
112
$actual = Set-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup - Tag @ {Name = $tagName2 ; Value = $tagValue2 }
110
113
$expected = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
111
114
112
115
# Assert
113
- Assert-AreEqual $expected.AccountName $actual.AccountName
116
+ Assert-AreEqual $expected.AccountName $actual.AccountName
114
117
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
115
- Assert-AreEqual $expected.Location $actual.Location
116
- Assert-AreEqual 1 $expected.Tags.Count
117
- Assert-AreEqual $tagName2 $expected.Tags [0 ][" Name" ]
118
- Assert-AreEqual $tagValue2 $expected.Tags [0 ][" Value" ]
118
+ Assert-AreEqual $expected.Location $actual.Location
119
+ Assert-AreEqual 1 $expected.Tags.Count
120
+ Assert-AreEqual $tagName2 $expected.Tags [0 ][" Name" ]
121
+ Assert-AreEqual $tagValue2 $expected.Tags [0 ][" Value" ]
119
122
Assert-AreEqual $expected.Tags [0 ][" Name" ] $actual.Tags [0 ][" Name" ]
120
- Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
123
+ Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
121
124
}
122
125
finally
123
126
{
@@ -134,36 +137,36 @@ function Test-GetBatchAccountsUnderResourceGroups
134
137
{
135
138
# Setup
136
139
$resourceGroup1 = Get-ResourceGroupName
137
- $resourceGroup2 = Get-ResourceGroupName
138
- $account11 = Get-BatchAccountName
139
- $account12 = Get-BatchAccountName
140
- $account21 = Get-BatchAccountName
140
+ $resourceGroup2 = Get-ResourceGroupName
141
+ $account11 = Get-BatchAccountName
142
+ $account12 = Get-BatchAccountName
143
+ $account21 = Get-BatchAccountName
141
144
$location1 = Get-BatchAccountProviderLocation
142
- $location2 = Get-BatchAccountProviderLocation 1
143
- $location3 = Get-BatchAccountProviderLocation 2
145
+ $location2 = Get-BatchAccountProviderLocation 4
146
+ $location3 = Get-BatchAccountProviderLocation 7
144
147
145
148
try
146
149
{
147
150
New-AzureRmResourceGroup - Name $resourceGroup1 - Location $location1
148
- New-AzureRmResourceGroup - Name $resourceGroup2 - Location $location1
149
- New-AzureRmBatchAccount - Name $account11 - ResourceGroupName $resourceGroup1 - Location $location1
150
- New-AzureRmBatchAccount - Name $account12 - ResourceGroupName $resourceGroup1 - Location $location2
151
- New-AzureRmBatchAccount - Name $account21 - ResourceGroupName $resourceGroup2 - Location $location3
151
+ New-AzureRmResourceGroup - Name $resourceGroup2 - Location $location1
152
+ New-AzureRmBatchAccount - Name $account11 - ResourceGroupName $resourceGroup1 - Location $location1
153
+ New-AzureRmBatchAccount - Name $account12 - ResourceGroupName $resourceGroup1 - Location $location2
154
+ New-AzureRmBatchAccount - Name $account21 - ResourceGroupName $resourceGroup2 - Location $location3
152
155
153
156
# Test
154
- $allAccounts = Get-AzureRmBatchAccount | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 -or $_.ResourceGroupName -eq $resourceGroup2 }
155
- $resourceGroup1Accounts = Get-AzureRmBatchAccount - ResourceGroupName $resourceGroup1
157
+ $allAccounts = Get-AzureRmBatchAccount | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 -or $_.ResourceGroupName -eq $resourceGroup2 }
158
+ $resourceGroup1Accounts = Get-AzureRmBatchAccount - ResourceGroupName $resourceGroup1
156
159
157
- # Assert
158
- Assert-AreEqual 3 $allAccounts.Count
159
- Assert-AreEqual 2 $resourceGroup1Accounts.Count
160
- Assert-AreEqual 2 ($resourceGroup1Accounts | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 }).Count
160
+ # Assert
161
+ Assert-AreEqual 3 $allAccounts.Count
162
+ Assert-AreEqual 2 $resourceGroup1Accounts.Count
163
+ Assert-AreEqual 2 ($resourceGroup1Accounts | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 }).Count
161
164
}
162
165
finally
163
166
{
164
167
# Cleanup
165
- Clean - BatchAccount $account11 $resourceGroup1
166
- Clean - BatchAccountAndResourceGroup $account12 $resourceGroup1
168
+ Clean - BatchAccount $account11 $resourceGroup1
169
+ Clean - BatchAccountAndResourceGroup $account12 $resourceGroup1
167
170
Clean - BatchAccountAndResourceGroup $account21 $resourceGroup2
168
171
}
169
172
}
@@ -177,28 +180,28 @@ function Test-CreateAndRemoveBatchAccountViaPiping
177
180
{
178
181
# Setup
179
182
$account1 = Get-BatchAccountName
180
- $account2 = Get-BatchAccountName
183
+ $account2 = Get-BatchAccountName
181
184
$resourceGroup = Get-ResourceGroupName
182
185
$location1 = Get-BatchAccountProviderLocation
183
- $location2 = Get-BatchAccountProviderLocation 1
184
-
185
- try
186
- {
187
- New-AzureRmResourceGroup - Name $resourceGroup - Location $location1
188
-
189
- # Test
190
- New-AzureRmBatchAccount - Name $account1 - ResourceGroupName $resourceGroup - Location $location1
191
- New-AzureRmBatchAccount - Name $account2 - ResourceGroupName $resourceGroup - Location $location2
192
- Get-AzureRmBatchAccount | where {$_.AccountName -eq $account1 -or $_.AccountName -eq $account2 } | Remove-AzureRmBatchAccount - Force
193
-
194
- # Assert
195
- Assert-Throws { Get-AzureRmBatchAccount - Name $account1 }
196
- Assert-Throws { Get-AzureRmBatchAccount - Name $account2 }
197
- }
198
- finally
199
- {
200
- Clean - ResourceGroup $resourceGroup
201
- }
186
+ $location2 = Get-BatchAccountProviderLocation 4
187
+
188
+ try
189
+ {
190
+ New-AzureRmResourceGroup - Name $resourceGroup - Location $location1
191
+
192
+ # Test
193
+ New-AzureRmBatchAccount - Name $account1 - ResourceGroupName $resourceGroup - Location $location1
194
+ New-AzureRmBatchAccount - Name $account2 - ResourceGroupName $resourceGroup - Location $location2
195
+ Get-AzureRmBatchAccount | where {$_.AccountName -eq $account1 -or $_.AccountName -eq $account2 } | Remove-AzureRmBatchAccount - Force
196
+
197
+ # Assert
198
+ Assert-Throws { Get-AzureRmBatchAccount - Name $account1 }
199
+ Assert-Throws { Get-AzureRmBatchAccount - Name $account2 }
200
+ }
201
+ finally
202
+ {
203
+ Clean - ResourceGroup $resourceGroup
204
+ }
202
205
}
203
206
204
207
<#
@@ -208,7 +211,7 @@ Tests getting/setting Batch account keys
208
211
function Test-BatchAccountKeys
209
212
{
210
213
# Setup
211
- $account = Get-BatchAccountName
214
+ $account = Get-BatchAccountName
212
215
$resourceGroup = Get-ResourceGroupName
213
216
$location = Get-BatchAccountProviderLocation
214
217
@@ -218,25 +221,25 @@ function Test-BatchAccountKeys
218
221
219
222
# Test
220
223
$new = New-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup - Location $location - Tag @ {Name = " testtag" ; Value = " testval" }
221
- $originalKeys = Get-AzureRmBatchAccountKeys - Name $account - ResourceGroupName $resourceGroup
222
- $originalPrimaryKey = $originalKeys.PrimaryAccountKey
223
- $originalSecondaryKey = $originalKeys.SecondaryAccountKey
224
- $newPrimary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Primary
225
- $newSecondary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Secondary
224
+ $originalKeys = Get-AzureRmBatchAccountKeys - Name $account - ResourceGroupName $resourceGroup
225
+ $originalPrimaryKey = $originalKeys.PrimaryAccountKey
226
+ $originalSecondaryKey = $originalKeys.SecondaryAccountKey
227
+ $newPrimary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Primary
228
+ $newSecondary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Secondary
226
229
$finalKeys = Get-AzureRmBatchAccountKeys - Name $account - ResourceGroupName $resourceGroup
227
- $getAccountResult = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
230
+ $getAccountResult = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
228
231
229
232
# Assert
230
- Assert-AreEqual $null $new.PrimaryAccountKey
233
+ Assert-AreEqual $null $new.PrimaryAccountKey
231
234
Assert-AreEqual $null $new.SecondaryAccountKey
232
- Assert-AreEqual $originalSecondaryKey $newPrimary.SecondaryAccountKey
233
- Assert-AreEqual $newPrimary.PrimaryAccountKey $newSecondary.PrimaryAccountKey
234
- Assert-AreEqual $newPrimary.PrimaryAccountKey $finalKeys.PrimaryAccountKey
235
- Assert-AreEqual $newSecondary.SecondaryAccountKey $finalKeys.SecondaryAccountKey
236
- Assert-AreNotEqual $originalPrimaryKey $newPrimary.PrimaryAccountKey
237
- Assert-AreNotEqual $originalSecondaryKey $newSecondary.SecondaryAccountKey
238
- Assert-AreEqual $null $getAccountResult.PrimaryAccountKey
239
- Assert-AreEqual $null $getAccountResult.SecondaryAccountKey
235
+ Assert-AreEqual $originalSecondaryKey $newPrimary.SecondaryAccountKey
236
+ Assert-AreEqual $newPrimary.PrimaryAccountKey $newSecondary.PrimaryAccountKey
237
+ Assert-AreEqual $newPrimary.PrimaryAccountKey $finalKeys.PrimaryAccountKey
238
+ Assert-AreEqual $newSecondary.SecondaryAccountKey $finalKeys.SecondaryAccountKey
239
+ Assert-AreNotEqual $originalPrimaryKey $newPrimary.PrimaryAccountKey
240
+ Assert-AreNotEqual $originalSecondaryKey $newSecondary.SecondaryAccountKey
241
+ Assert-AreEqual $null $getAccountResult.PrimaryAccountKey
242
+ Assert-AreEqual $null $getAccountResult.SecondaryAccountKey
240
243
}
241
244
finally
242
245
{
0 commit comments