Skip to content

Commit 07ebfcf

Browse files
committed
Merge pull request #580 from jasper-schneider/ver0701
Update Batch RP API version
2 parents 3b05292 + b3eae74 commit 07ebfcf

File tree

83 files changed

+11819
-35091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+11819
-35091
lines changed

src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.19.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6666
</Reference>
6767
<Reference Include="Microsoft.Azure.Management.Batch">
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Batch.1.3.0-preview\lib\net40\Microsoft.Azure.Management.Batch.dll</HintPath>
68+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Batch.1.4.0\lib\net40\Microsoft.Azure.Management.Batch.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.ResourceManager">
7171
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.1-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>

src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/BatchAccountTests.ps1

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,17 @@ function Test-GetBatchAccountsUnderResourceGroups
138138
$account11 = Get-BatchAccountName
139139
$account12 = Get-BatchAccountName
140140
$account21 = Get-BatchAccountName
141-
$location = Get-BatchAccountProviderLocation
141+
$location1 = Get-BatchAccountProviderLocation
142+
$location2 = Get-BatchAccountProviderLocation 1
143+
$location3 = Get-BatchAccountProviderLocation 2
142144

143145
try
144146
{
145-
New-AzureResourceGroup -Name $resourceGroup1 -Location $location
146-
New-AzureResourceGroup -Name $resourceGroup2 -Location $location
147-
New-AzureBatchAccount -Name $account11 -ResourceGroupName $resourceGroup1 -Location $location
148-
New-AzureBatchAccount -Name $account12 -ResourceGroupName $resourceGroup1 -Location $location
149-
New-AzureBatchAccount -Name $account21 -ResourceGroupName $resourceGroup2 -Location $location
147+
New-AzureResourceGroup -Name $resourceGroup1 -Location $location1
148+
New-AzureResourceGroup -Name $resourceGroup2 -Location $location1
149+
New-AzureBatchAccount -Name $account11 -ResourceGroupName $resourceGroup1 -Location $location1
150+
New-AzureBatchAccount -Name $account12 -ResourceGroupName $resourceGroup1 -Location $location2
151+
New-AzureBatchAccount -Name $account21 -ResourceGroupName $resourceGroup2 -Location $location3
150152

151153
# Test
152154
$allAccounts = Get-AzureBatchAccount | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 -or $_.ResourceGroupName -eq $resourceGroup2}
@@ -177,15 +179,16 @@ function Test-CreateAndRemoveBatchAccountViaPiping
177179
$account1 = Get-BatchAccountName
178180
$account2 = Get-BatchAccountName
179181
$resourceGroup = Get-ResourceGroupName
180-
$location = Get-BatchAccountProviderLocation
182+
$location1 = Get-BatchAccountProviderLocation
183+
$location2 = Get-BatchAccountProviderLocation 1
181184

182185
try
183186
{
184-
New-AzureResourceGroup -Name $resourceGroup -Location $location
187+
New-AzureResourceGroup -Name $resourceGroup -Location $location1
185188

186189
# Test
187-
New-AzureBatchAccount -Name $account1 -ResourceGroupName $resourceGroup -Location $location
188-
New-AzureBatchAccount -Name $account2 -ResourceGroupName $resourceGroup -Location $location
190+
New-AzureBatchAccount -Name $account1 -ResourceGroupName $resourceGroup -Location $location1
191+
New-AzureBatchAccount -Name $account2 -ResourceGroupName $resourceGroup -Location $location2
189192
Get-AzureBatchAccount | where {$_.AccountName -eq $account1 -or $_.AccountName -eq $account2} | Remove-AzureBatchAccount -Force
190193

191194
# Assert

src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/Common.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Get-ResourceGroupName
3434
.SYNOPSIS
3535
Gets the location for the Batch account provider. Default to West US if none found.
3636
#>
37-
function Get-BatchAccountProviderLocation
37+
function Get-BatchAccountProviderLocation($index)
3838
{
3939
$location = Get-AzureLocation | where {$_.Name -eq "Microsoft.Batch/batchAccounts"}
4040
if ($location -eq $null)
@@ -43,7 +43,14 @@ function Get-BatchAccountProviderLocation
4343
}
4444
else
4545
{
46-
$location.Locations[0]
46+
if ($index -eq $null)
47+
{
48+
$location.Locations[0]
49+
}
50+
else
51+
{
52+
$location.Locations[$index]
53+
}
4754
}
4855
}
4956

src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/FileTests.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,11 @@ namespace Microsoft.Azure.Commands.Batch.Test.ScenarioTests
2828
{
2929
public class FileTests
3030
{
31-
// NOTE: To save time on VM allocation when recording, these tests assume the following:
32-
// - A Batch account named 'filetests' exists under the subscription being used for recording.
33-
// - The following commands were run to create a pool, and all 3 VMs are allocated:
34-
// $context = Get-AzureBatchAccountKeys "filetests"
35-
// $startTask = New-Object Microsoft.Azure.Commands.Batch.Models.PSStartTask
36-
// $startTask.CommandLine = "cmd /c echo hello"
37-
// New-AzureBatchPool -Name "testPool" -VMSize "small" -OSFamily "4" -TargetOSVersion "*" -TargetDedicated 3 -StartTask $startTask -BatchContext $context
38-
39-
private const string accountName = "filetests";
40-
private const string poolName = "testPool";
41-
private const string vmName = "tvm-1900272697_1-20150331t200107z"; // Use the following command to get a VM name: (Get-AzureBatchVM -PoolName "testPool" -BatchContext $context)[0].Name
42-
private const string startTaskStdOutName = "startup\\stdout.txt";
43-
private const string startTaskStdOutContent = "hello";
31+
private const string accountName = ScenarioTestHelpers.SharedAccount;
32+
private const string poolName = ScenarioTestHelpers.SharedPool;
33+
private const string vmName = ScenarioTestHelpers.SharedPoolVM;
34+
private const string startTaskStdOutName = ScenarioTestHelpers.SharedPoolStartTaskStdOut;
35+
private const string startTaskStdOutContent = ScenarioTestHelpers.SharedPoolStartTaskStdOutContent;
4436

4537
[Fact]
4638
[Trait(Category.AcceptanceType, Category.CheckIn)]

src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/JobTests.cs

Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,52 +26,36 @@ namespace Microsoft.Azure.Commands.Batch.Test.ScenarioTests
2626
{
2727
public class JobTests
2828
{
29+
private const string accountName = ScenarioTestHelpers.SharedAccount;
30+
private const string poolName = ScenarioTestHelpers.SharedPool;
31+
2932
[Fact]
3033
[Trait(Category.AcceptanceType, Category.CheckIn)]
3134
public void TestGetJobRequiredParameters()
3235
{
3336
BatchController controller = BatchController.NewInstance;
34-
string resourceGroupName = "test-get-job-params";
35-
string accountName = "testgetjobparams";
36-
string location = "eastus";
37-
BatchAccountContext context = null;
38-
controller.RunPsTestWorkflow(
39-
() => { return new string[] { string.Format("Test-GetJobRequiredParameters '{0}'", accountName) }; },
40-
() =>
41-
{
42-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
43-
},
44-
() =>
45-
{
46-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
47-
},
48-
TestUtilities.GetCallingClass(),
49-
TestUtilities.GetCurrentMethodName());
37+
controller.RunPsTest(string.Format("Test-GetJobRequiredParameters '{0}'", accountName));
5038
}
5139

5240
[Fact]
5341
[Trait(Category.AcceptanceType, Category.CheckIn)]
5442
public void TestGetJobByName()
5543
{
5644
BatchController controller = BatchController.NewInstance;
57-
string resourceGroupName = "test-get-job";
58-
string accountName = "testgetjob";
59-
string location = "eastus";
6045
string workItemName = "testName";
6146
string jobName = null;
6247
BatchAccountContext context = null;
6348
controller.RunPsTestWorkflow(
6449
() => { return new string[] { string.Format("Test-GetJobByName '{0}' '{1}' '{2}'", accountName, workItemName, jobName) }; },
6550
() =>
6651
{
67-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
52+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
6853
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
6954
jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
7055
},
7156
() =>
7257
{
7358
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
74-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
7559
},
7660
TestUtilities.GetCallingClass(),
7761
TestUtilities.GetCurrentMethodName());
@@ -82,9 +66,6 @@ public void TestGetJobByName()
8266
public void TestListJobsByFilter()
8367
{
8468
BatchController controller = BatchController.NewInstance;
85-
string resourceGroupName = "test-list-job-filter";
86-
string accountName = "testlistjobfilter";
87-
string location = "eastus";
8869
string workItemName = "testWorkItem";
8970
string state = "active";
9071
int matches = 1;
@@ -94,7 +75,7 @@ public void TestListJobsByFilter()
9475
() =>
9576
{
9677
TimeSpan recurrence = TimeSpan.FromMinutes(1);
97-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
78+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
9879
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName, recurrence);
9980
string jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
10081
ScenarioTestHelpers.TerminateJob(context, workItemName, jobName);
@@ -103,7 +84,6 @@ public void TestListJobsByFilter()
10384
() =>
10485
{
10586
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
106-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
10787
},
10888
TestUtilities.GetCallingClass(),
10989
TestUtilities.GetCurrentMethodName());
@@ -114,9 +94,6 @@ public void TestListJobsByFilter()
11494
public void TestListJobsWithMaxCount()
11595
{
11696
BatchController controller = BatchController.NewInstance;
117-
string resourceGroupName = "test-list-job-maxcount";
118-
string accountName = "testlistjobmaxcount";
119-
string location = "eastus";
12097
string workItemName = "testWorkItem";
12198
int maxCount = 1;
12299
BatchAccountContext context = null;
@@ -125,7 +102,7 @@ public void TestListJobsWithMaxCount()
125102
() =>
126103
{
127104
TimeSpan recurrence = TimeSpan.FromMinutes(1);
128-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
105+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
129106
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName, recurrence);
130107
string jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
131108
ScenarioTestHelpers.TerminateJob(context, workItemName, jobName);
@@ -134,7 +111,6 @@ public void TestListJobsWithMaxCount()
134111
() =>
135112
{
136113
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
137-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
138114
},
139115
TestUtilities.GetCallingClass(),
140116
TestUtilities.GetCurrentMethodName());
@@ -145,9 +121,6 @@ public void TestListJobsWithMaxCount()
145121
public void TestListAllJobs()
146122
{
147123
BatchController controller = BatchController.NewInstance;
148-
string resourceGroupName = "test-list-job";
149-
string accountName = "testlistjob";
150-
string location = "eastus";
151124
string workItemName = "testWorkItem";
152125
int count = 2;
153126
BatchAccountContext context = null;
@@ -156,7 +129,7 @@ public void TestListAllJobs()
156129
() =>
157130
{
158131
TimeSpan recurrence = TimeSpan.FromMinutes(1);
159-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
132+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
160133
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName, recurrence);
161134
string jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
162135
ScenarioTestHelpers.TerminateJob(context, workItemName, jobName);
@@ -165,7 +138,6 @@ public void TestListAllJobs()
165138
() =>
166139
{
167140
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
168-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
169141
},
170142
TestUtilities.GetCallingClass(),
171143
TestUtilities.GetCurrentMethodName());
@@ -176,9 +148,6 @@ public void TestListAllJobs()
176148
public void TestListJobPipeline()
177149
{
178150
BatchController controller = BatchController.NewInstance;
179-
string resourceGroupName = "test-list-job-pipe";
180-
string accountName = "testlistjobpipe";
181-
string location = "eastus";
182151
string workItemName = "testWorkItem";
183152
string jobName = null;
184153

@@ -187,14 +156,13 @@ public void TestListJobPipeline()
187156
() => { return new string[] { string.Format("Test-ListJobPipeline '{0}' '{1}' '{2}'", accountName, workItemName, jobName) }; },
188157
() =>
189158
{
190-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
159+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
191160
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
192161
jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
193162
},
194163
() =>
195164
{
196165
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
197-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
198166
},
199167
TestUtilities.GetCallingClass(),
200168
TestUtilities.GetCurrentMethodName());
@@ -205,9 +173,6 @@ public void TestListJobPipeline()
205173
public void TestDeleteJob()
206174
{
207175
BatchController controller = BatchController.NewInstance;
208-
string resourceGroupName = "test-delete-job";
209-
string accountName = "testdeletejob";
210-
string location = "eastus";
211176
string workItemName = "testWorkItem";
212177
string jobName = null;
213178

@@ -216,14 +181,13 @@ public void TestDeleteJob()
216181
() => { return new string[] { string.Format("Test-DeleteJob '{0}' '{1}' '{2}' '0'", accountName, workItemName, jobName) }; },
217182
() =>
218183
{
219-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
184+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
220185
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
221186
jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
222187
},
223188
() =>
224189
{
225190
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
226-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
227191
},
228192
TestUtilities.GetCallingClass(),
229193
TestUtilities.GetCurrentMethodName());
@@ -234,9 +198,6 @@ public void TestDeleteJob()
234198
public void TestDeleteJobPipeline()
235199
{
236200
BatchController controller = BatchController.NewInstance;
237-
string resourceGroupName = "test-delete-job-pipe";
238-
string accountName = "testdeletejobpipe";
239-
string location = "eastus";
240201
string workItemName = "testWorkItem";
241202
string jobName = null;
242203

@@ -245,14 +206,13 @@ public void TestDeleteJobPipeline()
245206
() => { return new string[] { string.Format("Test-DeleteJob '{0}' '{1}' '{2}' '1'", accountName, workItemName, jobName) }; },
246207
() =>
247208
{
248-
context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
209+
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
249210
ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
250211
jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
251212
},
252213
() =>
253214
{
254215
ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
255-
ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
256216
},
257217
TestUtilities.GetCallingClass(),
258218
TestUtilities.GetCurrentMethodName());

0 commit comments

Comments
 (0)