Skip to content

Commit 1aa61fa

Browse files
author
jasper-schneider
committed
Reorganize compute node tests
1 parent 0f1b4d0 commit 1aa61fa

25 files changed

+3703
-14605
lines changed

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

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -352,55 +352,16 @@
352352
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.CertificateTests\TestCertificateCrudOperations.json">
353353
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
354354
</None>
355-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestDisableAndEnableComputeNodeSchedulingById.json">
355+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestDisableAndEnableComputeNodeScheduling.json">
356356
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
357357
</None>
358-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestDisableAndEnableComputeNodeSchedulingPipeline.json">
358+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetComputeNodeRemoteLoginSettings.json">
359359
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
360360
</None>
361-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetAndListComputeNodesWithSelect.json">
361+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRebootAndReimageComputeNode.json">
362362
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
363363
</None>
364-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetComputeNodeById.json">
365-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
366-
</None>
367-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetComputeNodeRemoteLoginSettingsById.json">
368-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
369-
</None>
370-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetComputeNodeRemoteLoginSettingsPipeline.json">
371-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
372-
</None>
373-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestListAllComputeNodes.json">
374-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
375-
</None>
376-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestListComputeNodePipeline.json">
377-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
378-
</None>
379-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestListComputeNodesByFilter.json">
380-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
381-
</None>
382-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestListComputeNodesWithMaxCount.json">
383-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
384-
</None>
385-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRebootComputeNodeById.json">
386-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
387-
</None>
388-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRebootComputeNodePipeline.json">
389-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
390-
</None>
391-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestReimageComputeNodeById.json">
392-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
393-
</None>
394-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestReimageComputeNodePipeline.json">
395-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
396-
</None>
397-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRemoveComputeNodeById.json">
398-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
399-
</None>
400-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRemoveComputeNodePipeline.json">
401-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
402-
</None>
403-
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRemoveMultipleComputeNodes.json">
364+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestRemoveComputeNodes.json">
404365
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
405366
</None>
406367
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeUserTests\TestComputeNodeUserEndToEnd.json">

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/ComputeNodeTests.cs

Lines changed: 18 additions & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -30,133 +30,43 @@ public ComputeNodeTests(Xunit.Abstractions.ITestOutputHelper output)
3030

3131
[Fact]
3232
[Trait(Category.AcceptanceType, Category.CheckIn)]
33-
public void TestGetComputeNodeById()
34-
{
35-
BatchController controller = BatchController.NewInstance;
36-
controller.RunPsTest(string.Format("Test-GetComputeNodeById '{0}'", poolId));
37-
}
38-
39-
[Fact]
40-
[Trait(Category.AcceptanceType, Category.CheckIn)]
41-
public void TestListComputeNodesByFilter()
42-
{
43-
BatchController controller = BatchController.NewInstance;
44-
BatchAccountContext context = null;
45-
string state = "idle";
46-
int matches = 0;
47-
controller.RunPsTestWorkflow(
48-
() => { return new string[] { string.Format("Test-ListComputeNodesByFilter '{0}' '{1}' '{2}'", poolId, state, matches) }; },
49-
() =>
50-
{
51-
context = new ScenarioTestContext();
52-
matches = ScenarioTestHelpers.GetPoolCurrentDedicated(controller, context, poolId);
53-
},
54-
null,
55-
TestUtilities.GetCallingClass(),
56-
TestUtilities.GetCurrentMethodName());
57-
}
58-
59-
[Fact]
60-
[Trait(Category.AcceptanceType, Category.CheckIn)]
61-
public void TestGetAndListComputeNodesWithSelect()
62-
{
63-
BatchController controller = BatchController.NewInstance;
64-
BatchAccountContext context = null;
65-
string computeNodeId = null;
66-
controller.RunPsTestWorkflow(
67-
() => { return new string[] { string.Format("Test-GetAndListComputeNodesWithSelect '{0}' '{1}'", poolId, computeNodeId) }; },
68-
() =>
69-
{
70-
context = new ScenarioTestContext();
71-
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
72-
},
73-
null,
74-
TestUtilities.GetCallingClass(),
75-
TestUtilities.GetCurrentMethodName());
76-
}
77-
78-
[Fact]
79-
[Trait(Category.AcceptanceType, Category.CheckIn)]
80-
public void TestListComputeNodesWithMaxCount()
81-
{
82-
BatchController controller = BatchController.NewInstance;
83-
int maxCount = 1;
84-
controller.RunPsTest(string.Format("Test-ListComputeNodesWithMaxCount '{0}' '{1}'", poolId, maxCount));
85-
}
86-
87-
[Fact]
88-
[Trait(Category.AcceptanceType, Category.CheckIn)]
89-
public void TestListAllComputeNodes()
33+
public void TestRemoveComputeNodes()
9034
{
9135
BatchController controller = BatchController.NewInstance;
9236
BatchAccountContext context = null;
93-
int computeNodeCount = 0;
37+
string removeNodePoolId = "removenodepool";
9438
controller.RunPsTestWorkflow(
95-
() => { return new string[] { string.Format("Test-ListAllComputeNodes '{0}' '{1}'", poolId, computeNodeCount) }; },
39+
() => { return new string[] { string.Format("Test-RemoveComputeNodes '{0}'", removeNodePoolId) }; },
9640
() =>
9741
{
9842
context = new ScenarioTestContext();
99-
computeNodeCount = ScenarioTestHelpers.GetPoolCurrentDedicated(controller, context, poolId);
43+
ScenarioTestHelpers.CreateTestPool(controller, context, removeNodePoolId, 2);
44+
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, removeNodePoolId);
10045
},
101-
null,
102-
TestUtilities.GetCallingClass(),
103-
TestUtilities.GetCurrentMethodName());
104-
}
105-
106-
[Fact]
107-
[Trait(Category.AcceptanceType, Category.CheckIn)]
108-
public void TestListComputeNodePipeline()
109-
{
110-
BatchController controller = BatchController.NewInstance;
111-
BatchAccountContext context = null;
112-
int computeNodeCount = 0;
113-
controller.RunPsTestWorkflow(
114-
() => { return new string[] { string.Format("Test-ListComputeNodePipeline '{0}' '{1}'", poolId, computeNodeCount) }; },
11546
() =>
11647
{
117-
context = new ScenarioTestContext();
118-
computeNodeCount = ScenarioTestHelpers.GetPoolCurrentDedicated(controller, context, poolId);
48+
ScenarioTestHelpers.DeletePool(controller, context, removeNodePoolId);
11949
},
120-
null,
12150
TestUtilities.GetCallingClass(),
12251
TestUtilities.GetCurrentMethodName());
12352
}
12453

12554
[Fact]
12655
[Trait(Category.AcceptanceType, Category.CheckIn)]
127-
public void TestRemoveComputeNodeById()
128-
{
129-
TestRemoveComputeNode(usePipeline: false, testMethodName: TestUtilities.GetCurrentMethodName());
130-
}
131-
132-
[Fact]
133-
[Trait(Category.AcceptanceType, Category.CheckIn)]
134-
public void TestRemoveComputeNodePipeline()
135-
{
136-
TestRemoveComputeNode(usePipeline: true, testMethodName: TestUtilities.GetCurrentMethodName());
137-
}
138-
139-
[Fact]
140-
[Trait(Category.AcceptanceType, Category.CheckIn)]
141-
public void TestRemoveMultipleComputeNodes()
56+
public void TestRebootAndReimageComputeNode()
14257
{
14358
BatchController controller = BatchController.NewInstance;
14459
BatchAccountContext context = null;
14560
string computeNodeId = null;
14661
string computeNodeId2 = null;
147-
int originalDedicated = 3;
14862
controller.RunPsTestWorkflow(
149-
() => { return new string[] { string.Format("Test-RemoveMultipleComputeNodes '{0}' '{1}' '{2}'", poolId, computeNodeId, computeNodeId2) }; },
63+
() => { return new string[] { string.Format("Test-RebootAndReimageComputeNode '{0}' '{1}' '{2}'", poolId, computeNodeId, computeNodeId2) }; },
15064
() =>
15165
{
15266
context = new ScenarioTestContext();
153-
originalDedicated = ScenarioTestHelpers.GetPoolCurrentDedicated(controller, context, poolId);
154-
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, poolId);
155-
ScenarioTestHelpers.ResizePool(controller, context, poolId, originalDedicated + 2);
156-
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, poolId);
157-
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
158-
ScenarioTestHelpers.WaitForIdleComputeNode(controller, context, poolId, computeNodeId);
67+
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId, 0);
15968
computeNodeId2 = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId, 1);
69+
ScenarioTestHelpers.WaitForIdleComputeNode(controller, context, poolId, computeNodeId);
16070
ScenarioTestHelpers.WaitForIdleComputeNode(controller, context, poolId, computeNodeId2);
16171
},
16272
null,
@@ -166,110 +76,13 @@ public void TestRemoveMultipleComputeNodes()
16676

16777
[Fact]
16878
[Trait(Category.AcceptanceType, Category.CheckIn)]
169-
public void TestRebootComputeNodeById()
170-
{
171-
TestRebootComputeNode(usePipeline: false, testMethodName: TestUtilities.GetCurrentMethodName());
172-
}
173-
174-
[Fact]
175-
[Trait(Category.AcceptanceType, Category.CheckIn)]
176-
public void TestRebootComputeNodePipeline()
177-
{
178-
TestRebootComputeNode(usePipeline: true, testMethodName: TestUtilities.GetCurrentMethodName());
179-
}
180-
181-
[Fact]
182-
[Trait(Category.AcceptanceType, Category.CheckIn)]
183-
public void TestReimageComputeNodeById()
184-
{
185-
TestReimageComputeNode(usePipeline: false, testMethodName: TestUtilities.GetCurrentMethodName());
186-
}
187-
188-
[Fact]
189-
[Trait(Category.AcceptanceType, Category.CheckIn)]
190-
public void TestReimageComputeNodePipeline()
191-
{
192-
TestReimageComputeNode(usePipeline: true, testMethodName: TestUtilities.GetCurrentMethodName());
193-
}
194-
195-
[Fact]
196-
[Trait(Category.AcceptanceType, Category.CheckIn)]
197-
public void TestDisableAndEnableComputeNodeSchedulingById()
198-
{
199-
TestDisableAndEnableComputeNodeScheduling(usePipeline: false, testMethodName: TestUtilities.GetCurrentMethodName());
200-
}
201-
202-
[Fact]
203-
[Trait(Category.AcceptanceType, Category.CheckIn)]
204-
public void TestDisableAndEnableComputeNodeSchedulingPipeline()
205-
{
206-
TestDisableAndEnableComputeNodeScheduling(usePipeline: true, testMethodName: TestUtilities.GetCurrentMethodName());
207-
}
208-
209-
[Fact]
210-
[Trait(Category.AcceptanceType, Category.CheckIn)]
211-
public void TestGetComputeNodeRemoteLoginSettingsById()
212-
{
213-
TestGetComputeNodeRemoteLoginSettings(usePipeline: false, testMethodName: TestUtilities.GetCurrentMethodName());
214-
}
215-
216-
[Fact]
217-
[Trait(Category.AcceptanceType, Category.CheckIn)]
218-
public void TestGetComputeNodeRemoteLoginSettingsPipeline()
219-
{
220-
TestGetComputeNodeRemoteLoginSettings(usePipeline: true, testMethodName: TestUtilities.GetCurrentMethodName());
221-
}
222-
223-
private void TestRemoveComputeNode(bool usePipeline, string testMethodName)
79+
public void TestDisableAndEnableComputeNodeScheduling()
22480
{
22581
BatchController controller = BatchController.NewInstance;
22682
BatchAccountContext context = null;
22783
string computeNodeId = null;
228-
int originalDedicated = 3;
22984
controller.RunPsTestWorkflow(
230-
() => { return new string[] { string.Format("Test-RemoveComputeNode '{0}' '{1}' '{2}'", poolId, computeNodeId, usePipeline ? 1 : 0) }; },
231-
() =>
232-
{
233-
context = new ScenarioTestContext();
234-
originalDedicated = ScenarioTestHelpers.GetPoolCurrentDedicated(controller, context, poolId);
235-
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, poolId);
236-
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
237-
ScenarioTestHelpers.WaitForIdleComputeNode(controller, context, poolId, computeNodeId);
238-
},
239-
() =>
240-
{
241-
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, poolId);
242-
ScenarioTestHelpers.ResizePool(controller, context, poolId, originalDedicated);
243-
},
244-
TestUtilities.GetCallingClass(),
245-
testMethodName);
246-
}
247-
248-
private void TestRebootComputeNode(bool usePipeline, string testMethodName)
249-
{
250-
BatchController controller = BatchController.NewInstance;
251-
BatchAccountContext context = null;
252-
string computeNodeId = null;
253-
controller.RunPsTestWorkflow(
254-
() => { return new string[] { string.Format("Test-RebootComputeNode '{0}' '{1}' '{2}'", poolId, computeNodeId, usePipeline ? 1 : 0) }; },
255-
() =>
256-
{
257-
context = new ScenarioTestContext();
258-
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
259-
ScenarioTestHelpers.WaitForIdleComputeNode(controller, context, poolId, computeNodeId);
260-
},
261-
null,
262-
TestUtilities.GetCallingClass(),
263-
testMethodName);
264-
}
265-
266-
private void TestReimageComputeNode(bool usePipeline, string testMethodName)
267-
{
268-
BatchController controller = BatchController.NewInstance;
269-
BatchAccountContext context = null;
270-
string computeNodeId = null;
271-
controller.RunPsTestWorkflow(
272-
() => { return new string[] { string.Format("Test-ReimageComputeNode '{0}' '{1}' '{2}'", poolId, computeNodeId, usePipeline ? 1 : 0) }; },
85+
() => { return new string[] { string.Format("Test-DisableAndEnableComputeNodeScheduling '{0}' '{1}'", poolId, computeNodeId) }; },
27386
() =>
27487
{
27588
context = new ScenarioTestContext();
@@ -278,43 +91,27 @@ private void TestReimageComputeNode(bool usePipeline, string testMethodName)
27891
},
27992
null,
28093
TestUtilities.GetCallingClass(),
281-
testMethodName);
282-
}
283-
284-
private void TestDisableAndEnableComputeNodeScheduling(bool usePipeline, string testMethodName)
285-
{
286-
BatchController controller = BatchController.NewInstance;
287-
BatchAccountContext context = null;
288-
string computeNodeId = null;
289-
controller.RunPsTestWorkflow(
290-
() => { return new string[] { string.Format("Test-DisableAndEnableComputeNodeScheduling '{0}' '{1}' '{2}'", poolId, computeNodeId, usePipeline ? 1 : 0) }; },
291-
() =>
292-
{
293-
context = new ScenarioTestContext();
294-
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
295-
ScenarioTestHelpers.WaitForIdleComputeNode(controller, context, poolId, computeNodeId);
296-
},
297-
null,
298-
TestUtilities.GetCallingClass(),
299-
testMethodName);
94+
TestUtilities.GetCurrentMethodName());
30095
}
30196

302-
private void TestGetComputeNodeRemoteLoginSettings(bool usePipeline, string testMethodName)
97+
[Fact]
98+
[Trait(Category.AcceptanceType, Category.CheckIn)]
99+
public void TestGetComputeNodeRemoteLoginSettings()
303100
{
304101
BatchController controller = BatchController.NewInstance;
305102
BatchAccountContext context = null;
306103
string computeNodeId = null;
307104

308105
controller.RunPsTestWorkflow(
309-
() => { return new string[] { string.Format("Test-GetRemoteLoginSettings '{0}' '{1}' '{2}'", iaasPoolId, computeNodeId, usePipeline ? 1 : 0) }; },
106+
() => { return new string[] { string.Format("Test-GetRemoteLoginSettings '{0}' '{1}'", iaasPoolId, computeNodeId) }; },
310107
() =>
311108
{
312109
context = new ScenarioTestContext();
313110
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, iaasPoolId);
314111
},
315112
null,
316113
TestUtilities.GetCallingClass(),
317-
testMethodName);
114+
TestUtilities.GetCurrentMethodName());
318115
}
319116
}
320117
}

0 commit comments

Comments
 (0)