Skip to content

. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jun 16, 2015
Merged

. #24

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
28e351f
Fixes to set and remove diag extension cmdlets
brahmnes Jun 5, 2015
7af0782
Start-AzureBatchPoolResize with tests and help. Updating help with co…
Jun 8, 2015
bde80c2
Stop-AzureBatchPoolResize with tests and help
Jun 9, 2015
e8a1745
Update HDInsight and HDInsight.Test refs to SDK version 1.5.9
hallihan Jun 10, 2015
0c5b689
Incorporating feedback
Jun 10, 2015
504c25b
Merge remote-tracking branch 'upstream/dev' into resize
Jun 10, 2015
339f1d0
Extending Azure SQL CRUD PowerShell cmdlets for Azure SQL Data Warehouse
caln-microsoft Jun 11, 2015
5efc145
Add Test-AzureResource and Test-AzureResourceGroup cmdlets
vivsriaus Jun 12, 2015
b4bb229
Added ContentDisposition to ValidCloudBlobProperties
Peter-Schneider Jun 14, 2015
00e1b93
Timeouts in playback mode to be 0
yoavrubin Jun 14, 2015
0740748
Merge pull request #503 from yoavrubin/dev
ogail Jun 15, 2015
fe2b0bb
Rename TestAzureResourceGroup class to TestAzureResourceGroupCmdlet
vivsriaus Jun 15, 2015
8de0b9d
Merge pull request #487 from jasper-schneider/resize
ogail Jun 15, 2015
bf478ff
Add warning when user doesn't specify enddatetime for slice commands
jackmagic313 Jun 15, 2015
42dfee7
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
jackmagic313 Jun 15, 2015
82132a1
Merge pull request #500 from vivsriaus/dev
ogail Jun 15, 2015
ff24ec7
Merge pull request #486 from rickmsft/UpdateHDISDK1.5.9
ogail Jun 15, 2015
7e36ee8
Merge pull request #502 from Peter-Schneider/fixes/498
ogail Jun 15, 2015
4bdae8f
Add change for designer
jackmagic313 Jun 15, 2015
1bffafd
Merge pull request #484 from brahmnes/dev
ogail Jun 15, 2015
b430053
Merge pull request #505 from jackmagic313/dev
ogail Jun 15, 2015
5007887
Merge pull request #495 from caln-microsoft/dev
ogail Jun 15, 2015
1948fb0
Refactor resource lock cmdlets
vivsriaus Jun 15, 2015
a259013
Merge pull request #506 from vivsriaus/dev
ogail Jun 15, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
2015.06.05 version 0.9.3
2015.06.25 version 0.9.4
* Added Batch cmdlets
* Start-AzureBatchPoolResize
* Stop-AzureBatchPoolResize

2015.06.05 version 0.9.3
* Fixed bug in Websites cmdlets related to slots #454
* Fix bug in Set-AzureResource cmdlet #456
* Fix for new azure resource of Microsoft.Storage #457
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
<Compile Include="Pools\GetBatchPoolCommandTests.cs" />
<Compile Include="Pools\NewBatchPoolCommandTests.cs" />
<Compile Include="Pools\RemoveBatchPoolCommandTests.cs" />
<Compile Include="Pools\StartBatchPoolResizeCommandTests.cs" />
<Compile Include="Pools\StopBatchPoolResizeCommandTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScenarioTests\BatchAccountTests.cs" />
<Compile Include="ScenarioTests\BatchController.cs" />
Expand Down Expand Up @@ -339,6 +341,18 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestNewPool.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestResizePoolByName.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestResizePoolByPipeline.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestStopResizePoolByName.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestStopResizePoolByPipeline.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.TaskTests\TestCreateTask.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.Azure.Batch;
using Microsoft.Azure.Batch.Protocol;
using Microsoft.Azure.Batch.Protocol.Entities;
using Microsoft.Azure.Commands.Batch.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Threading.Tasks;
using Xunit;
using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;

namespace Microsoft.Azure.Commands.Batch.Test.Pools
{
public class StartBatchPoolResizeCommandTests
{
private StartBatchPoolResizeCommand cmdlet;
private Mock<BatchClient> batchClientMock;
private Mock<ICommandRuntime> commandRuntimeMock;

public StartBatchPoolResizeCommandTests()
{
batchClientMock = new Mock<BatchClient>();
commandRuntimeMock = new Mock<ICommandRuntime>();
cmdlet = new StartBatchPoolResizeCommand()
{
CommandRuntime = commandRuntimeMock.Object,
BatchClient = batchClientMock.Object,
};
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void StartPoolResizeParametersTest()
{
BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
cmdlet.BatchContext = context;
cmdlet.Name = null;

Assert.Throws<ArgumentNullException>(() => cmdlet.ExecuteCmdlet());

cmdlet.Name = "testPool";

// Don't go to the service on a ResizePool call
YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) =>
{
if (request is ResizePoolRequest)
{
ResizePoolResponse response = new ResizePoolResponse();
Task<object> task = Task<object>.Factory.StartNew(() => { return response; });
return task;
}
return null;
});
cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor };

// Verify no exceptions when required parameter is set
cmdlet.ExecuteCmdlet();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.Azure.Batch;
using Microsoft.Azure.Batch.Protocol;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Threading.Tasks;
using Xunit;
using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;

namespace Microsoft.Azure.Commands.Batch.Test.Pools
{
public class StopBatchPoolResizeCommandTests
{
private StopBatchPoolResizeCommand cmdlet;
private Mock<BatchClient> batchClientMock;
private Mock<ICommandRuntime> commandRuntimeMock;

public StopBatchPoolResizeCommandTests()
{
batchClientMock = new Mock<BatchClient>();
commandRuntimeMock = new Mock<ICommandRuntime>();
cmdlet = new StopBatchPoolResizeCommand()
{
CommandRuntime = commandRuntimeMock.Object,
BatchClient = batchClientMock.Object,
};
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void StopPoolResizeParametersTest()
{
BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
cmdlet.BatchContext = context;
cmdlet.Name = null;

Assert.Throws<ArgumentNullException>(() => cmdlet.ExecuteCmdlet());

cmdlet.Name = "testPool";

// Don't go to the service on a StopPoolResize call
YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) =>
{
if (request is StopPoolResizeRequest)
{
StopPoolResizeResponse response = new StopPoolResizeResponse();
Task<object> task = Task<object>.Factory.StartNew(() => { return response; });
return task;
}
return null;
});
cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor };

// Verify no exceptions when required parameter is set
cmdlet.ExecuteCmdlet();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Batch;
using Microsoft.Azure.Commands.Batch.Models;
using Microsoft.Azure.Test;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using System.Collections.Generic;
Expand All @@ -24,6 +25,15 @@ namespace Microsoft.Azure.Commands.Batch.Test.ScenarioTests
{
public class PoolTests
{
// NOTE: To save time on VM allocation when recording, some of tests assume the following:
// - A Batch account named 'pooltests' exists under the subscription being used for recording.
// - The following commands were run to create a pool, and all 3 VMs are allocated:
// $context = Get-AzureBatchAccountKeys "pooltests"
// New-AzureBatchPool -Name "testPool" -VMSize "small" -OSFamily "4" -TargetOSVersion "*" -TargetDedicated 3 -BatchContext $context

private const string commonAccountName = "pooltests";
private const string testPoolName = "testPool";

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewPool()
Expand Down Expand Up @@ -224,6 +234,78 @@ public void TestDeletePoolPipeline()
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestResizePoolByName()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ResizePoolByName '{0}' '{1}'", commonAccountName, testPoolName) }; },
() =>
{
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, commonAccountName);
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, testPoolName);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestResizePoolByPipeline()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ResizePoolByPipeline '{0}' '{1}'", commonAccountName, testPoolName) }; },
() =>
{
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, commonAccountName);
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, testPoolName);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStopResizePoolByName()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-StopResizePoolByName '{0}' '{1}'", commonAccountName, testPoolName) }; },
() =>
{
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, commonAccountName);
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, testPoolName);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStopResizePoolByPipeline()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-StopResizePoolByPipeline '{0}' '{1}'", commonAccountName, testPoolName) }; },
() =>
{
context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, commonAccountName);
ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, testPoolName);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
}

// Cmdlets that use the HTTP Recorder interceptor for use with scenario tests
Expand Down Expand Up @@ -256,4 +338,24 @@ public override void ExecuteCmdlet()
base.ExecuteCmdlet();
}
}

[Cmdlet(VerbsLifecycle.Start, "AzureBatchPoolResize_ST")]
public class StartBatchPoolResizeScenarioTestCommand : StartBatchPoolResizeCommand
{
public override void ExecuteCmdlet()
{
AdditionalBehaviors = new List<BatchClientBehavior>() { ScenarioTestHelpers.CreateHttpRecordingInterceptor() };
base.ExecuteCmdlet();
}
}

[Cmdlet(VerbsLifecycle.Stop, "AzureBatchPoolResize_ST")]
public class StopBatchPoolResizeScenarioTestCommand : StopBatchPoolResizeCommand
{
public override void ExecuteCmdlet()
{
AdditionalBehaviors = new List<BatchClientBehavior>() { ScenarioTestHelpers.CreateHttpRecordingInterceptor() };
base.ExecuteCmdlet();
}
}
}
Loading