Skip to content

. #95

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 5 commits into from
Sep 21, 2015
Merged

. #95

Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private void TestReimageComputeNode(bool usePipeline)
}

// Cmdlets that use the HTTP Recorder interceptor for use with scenario tests
[Cmdlet(VerbsCommon.Get, "AzureRMBatchComputeNode_ST", DefaultParameterSetName = Constants.ODataFilterParameterSet)]
[Cmdlet(VerbsCommon.Get, "AzureBatchComputeNode_ST", DefaultParameterSetName = Constants.ODataFilterParameterSet)]
public class GetBatchComputeNodeScenarioTestCommand : GetBatchComputeNodeCommand
{
protected override void ProcessRecord()
Expand All @@ -180,7 +180,7 @@ protected override void ProcessRecord()
}
}

[Cmdlet(VerbsLifecycle.Restart, "AzureRMBatchComputeNode_ST", DefaultParameterSetName = Constants.IdParameterSet)]
[Cmdlet(VerbsLifecycle.Restart, "AzureBatchComputeNode_ST", DefaultParameterSetName = Constants.IdParameterSet)]
public class RestartBatchComputeNodeScenarioTestCommand : RestartBatchComputeNodeCommand
{
protected override void ProcessRecord()
Expand All @@ -190,7 +190,7 @@ protected override void ProcessRecord()
}
}

[Cmdlet(VerbsCommon.Reset, "AzureRMBatchComputeNode_ST", DefaultParameterSetName = Constants.IdParameterSet)]
[Cmdlet(VerbsCommon.Reset, "AzureBatchComputeNode_ST", DefaultParameterSetName = Constants.IdParameterSet)]
public class ResetBatchComputeNodeScenarioTestCommand : ResetBatchComputeNodeCommand
{
protected override void ProcessRecord()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ function Test-GetComputeNodeById
param([string]$accountName, [string]$poolId)

$context = Get-AzureRMBatchAccountKeys -Name $accountName
$computeNodeId = (Get-AzureRMBatchComputeNode_ST -PoolId $poolId -BatchContext $context)[0].Id
$computeNodeId = (Get-AzureBatchComputeNode_ST -PoolId $poolId -BatchContext $context)[0].Id

$computeNode = Get-AzureRMBatchComputeNode_ST -PoolId $poolId -Id $computeNodeId -BatchContext $context
$computeNode = Get-AzureBatchComputeNode_ST -PoolId $poolId -Id $computeNodeId -BatchContext $context

Assert-AreEqual $computeNodeId $computeNode.Id

# Verify positional parameters also work
$computeNode = Get-AzureRMBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context
$computeNode = Get-AzureBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context

Assert-AreEqual $computeNodeId $computeNode.Id
}
Expand All @@ -44,7 +44,7 @@ function Test-ListComputeNodesByFilter
$context = Get-AzureRMBatchAccountKeys -Name $accountName
$filter = "state eq '" + "$state" + "'"

$computeNodes = Get-AzureRMBatchComputeNode_ST -PoolId $poolId -Filter $filter -BatchContext $context
$computeNodes = Get-AzureBatchComputeNode_ST -PoolId $poolId -Filter $filter -BatchContext $context

Assert-AreEqual $matches $computeNodes.Length
foreach($node in $computeNodes)
Expand All @@ -53,8 +53,8 @@ function Test-ListComputeNodesByFilter
}

# Verify parent object parameter set also works
$pool = Get-AzureRMBatchPool_ST $poolId -BatchContext $context
$computeNodes = Get-AzureRMBatchComputeNode_ST -Pool $pool -Filter $filter -BatchContext $context
$pool = Get-AzureBatchPool_ST $poolId -BatchContext $context
$computeNodes = Get-AzureBatchComputeNode_ST -Pool $pool -Filter $filter -BatchContext $context

Assert-AreEqual $matches $computeNodes.Length
foreach($node in $computeNodes)
Expand All @@ -72,13 +72,13 @@ function Test-ListComputeNodesWithMaxCount
param([string]$accountName, [string]$poolId, [string]$maxCount)

$context = Get-AzureRMBatchAccountKeys -Name $accountName
$computeNodes = Get-AzureRMBatchComputeNode_ST -PoolId $poolId -MaxCount $maxCount -BatchContext $context
$computeNodes = Get-AzureBatchComputeNode_ST -PoolId $poolId -MaxCount $maxCount -BatchContext $context

Assert-AreEqual $maxCount $computeNodes.Length

# Verify parent object parameter set also works
$pool = Get-AzureRMBatchPool_ST $poolId -BatchContext $context
$computeNodes = Get-AzureRMBatchComputeNode_ST -Pool $pool -MaxCount $maxCount -BatchContext $context
$pool = Get-AzureBatchPool_ST $poolId -BatchContext $context
$computeNodes = Get-AzureBatchComputeNode_ST -Pool $pool -MaxCount $maxCount -BatchContext $context

Assert-AreEqual $maxCount $computeNodes.Length
}
Expand All @@ -92,27 +92,27 @@ function Test-ListAllComputeNodes
param([string]$accountName, [string]$poolId, [string]$count)

$context = Get-AzureRMBatchAccountKeys -Name $accountName
$computeNodes = Get-AzureRMBatchComputeNode_ST -PoolId $poolId -BatchContext $context
$computeNodes = Get-AzureBatchComputeNode_ST -PoolId $poolId -BatchContext $context

Assert-AreEqual $count $computeNodes.Length

# Verify parent object parameter set also works
$pool = Get-AzureRMBatchPool_ST $poolId -BatchContext $context
$computeNodes = Get-AzureRMBatchComputeNode_ST -Pool $pool -BatchContext $context
$pool = Get-AzureBatchPool_ST $poolId -BatchContext $context
$computeNodes = Get-AzureBatchComputeNode_ST -Pool $pool -BatchContext $context

Assert-AreEqual $count $computeNodes.Length
}

<#
.SYNOPSIS
Tests piping Get-AzureRMBatchPool into Get-AzureRMBatchComputeNode
Tests piping Get-AzureBatchPool into Get-AzureBatchComputeNode
#>
function Test-ListComputeNodePipeline
{
param([string]$accountName, [string]$poolId, [string]$count)

$context = Get-AzureRMBatchAccountKeys -Name $accountName
$computeNodes = Get-AzureRMBatchPool_ST -Id $poolId -BatchContext $context | Get-AzureRMBatchComputeNode_ST -BatchContext $context
$computeNodes = Get-AzureBatchPool_ST -Id $poolId -BatchContext $context | Get-AzureBatchComputeNode_ST -BatchContext $context

Assert-AreEqual $count $computeNodes.Count
}
Expand All @@ -131,14 +131,14 @@ function Test-RebootComputeNode

if ($usePipeline -eq '1')
{
Get-AzureRMBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context | Restart-AzureRMBatchComputeNode_ST -RebootOption $rebootOption -BatchContext $context
Get-AzureBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context | Restart-AzureBatchComputeNode_ST -RebootOption $rebootOption -BatchContext $context
}
else
{
Restart-AzureRMBatchComputeNode_ST $poolId $computeNodeId -RebootOption $rebootOption -BatchContext $context
Restart-AzureBatchComputeNode_ST $poolId $computeNodeId -RebootOption $rebootOption -BatchContext $context
}

$computeNode = Get-AzureRMBatchComputeNode_ST -PoolId $poolId -Filter "id eq '$computeNodeId'" -BatchContext $context
$computeNode = Get-AzureBatchComputeNode_ST -PoolId $poolId -Filter "id eq '$computeNodeId'" -BatchContext $context

Assert-AreEqual 'Rebooting' $computeNode.State
}
Expand All @@ -157,14 +157,14 @@ function Test-ReimageComputeNode

if ($usePipeline -eq '1')
{
Get-AzureRMBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context | Reset-AzureRMBatchComputeNode_ST -ReimageOption $reimageOption -BatchContext $context
Get-AzureBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context | Reset-AzureBatchComputeNode_ST -ReimageOption $reimageOption -BatchContext $context
}
else
{
Reset-AzureRMBatchComputeNode_ST $poolId $computeNodeId -ReimageOption $reimageOption -BatchContext $context
Reset-AzureBatchComputeNode_ST $poolId $computeNodeId -ReimageOption $reimageOption -BatchContext $context
}

$computeNode = Get-AzureRMBatchComputeNode_ST -PoolId $poolId -Filter "id eq '$computeNodeId'" -BatchContext $context
$computeNode = Get-AzureBatchComputeNode_ST -PoolId $poolId -Filter "id eq '$computeNodeId'" -BatchContext $context

Assert-AreEqual 'Reimaging' $computeNode.State
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void TestDeleteComputeNodeUser()
}

// Cmdlets that use the HTTP Recorder interceptor for use with scenario tests
[Cmdlet(VerbsCommon.New, "AzureRMBatchComputeNodeUser_ST")]
[Cmdlet(VerbsCommon.New, "AzureBatchComputeNodeUser_ST")]
public class NewBatchComputeNodeUserScenarioTestCommand : NewBatchComputeNodeUserCommand
{
protected override void ProcessRecord()
Expand All @@ -105,7 +105,7 @@ protected override void ProcessRecord()
}
}

[Cmdlet(VerbsCommon.Remove, "AzureRMBatchComputeNodeUser_ST")]
[Cmdlet(VerbsCommon.Remove, "AzureBatchComputeNodeUser_ST")]
public class RemoveBatchComputeNodeUserScenarioTestCommand : RemoveBatchComputeNodeUserCommand
{
protected override void ProcessRecord()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ function Test-CreateComputeNodeUser
if ($usePipeline -eq '1')
{
$expiryTime = New-Object DateTime -ArgumentList @(2020,01,01)
$computeNode = Get-AzureRMBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context
$computeNode | New-AzureRMBatchComputeNodeUser_ST -Name $userName -Password $password -ExpiryTime $expiryTime -IsAdmin -BatchContext $context
$computeNode = Get-AzureBatchComputeNode_ST $poolId $computeNodeId -BatchContext $context
$computeNode | New-AzureBatchComputeNodeUser_ST -Name $userName -Password $password -ExpiryTime $expiryTime -IsAdmin -BatchContext $context
}
else
{
New-AzureRMBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Password $password -BatchContext $context
New-AzureBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Password $password -BatchContext $context
}

# Verify that a user was created
# There is currently no Get/List user API, so verify by calling the delete operation.
# If the user account was created, it will succeed; otherwsie, it will throw a 404 error.
Remove-AzureRMBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Force -BatchContext $context
Remove-AzureBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Force -BatchContext $context
}

<#
Expand All @@ -51,9 +51,9 @@ function Test-DeleteComputeNodeUser

$context = Get-AzureRMBatchAccountKeys -Name $accountName

Remove-AzureRMBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Force -BatchContext $context
Remove-AzureBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Force -BatchContext $context

# Verify the user was deleted
# There is currently no Get/List user API, so try to delete the user again and verify that it fails.
Assert-Throws { Remove-AzureRMBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Force -BatchContext $context }
Assert-Throws { Remove-AzureBatchComputeNodeUser_ST -PoolId $poolId -ComputeNodeId $computeNodeId -Name $userName -Force -BatchContext $context }
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public void TestGetRemoteDesktopProtocolFilePipeline()
}

// Cmdlets that use the HTTP Recorder interceptor for use with scenario tests
[Cmdlet(VerbsCommon.Get, "AzureRMBatchNodeFile_ST", DefaultParameterSetName = ComputeNodeAndIdParameterSet)]
[Cmdlet(VerbsCommon.Get, "AzureBatchNodeFile_ST", DefaultParameterSetName = ComputeNodeAndIdParameterSet)]
public class GetBatchNodeFileScenarioTestCommand : GetBatchNodeFileCommand
{
protected override void ProcessRecord()
Expand All @@ -456,7 +456,7 @@ protected override void ProcessRecord()
}
}

[Cmdlet(VerbsCommon.Get, "AzureRMBatchNodeFileContent_ST")]
[Cmdlet(VerbsCommon.Get, "AzureBatchNodeFileContent_ST")]
public class GetBatchNodeFileContentScenarioTestCommand : GetBatchNodeFileContentCommand
{
protected override void ProcessRecord()
Expand All @@ -466,7 +466,7 @@ protected override void ProcessRecord()
}
}

[Cmdlet(VerbsCommon.Get, "AzureRMBatchRemoteDesktopProtocolFile_ST")]
[Cmdlet(VerbsCommon.Get, "AzureBatchRemoteDesktopProtocolFile_ST")]
public class GetBatchRemoteDesktopProtocolFileScenarioTestCommand : GetBatchRemoteDesktopProtocolFileCommand
{
protected override void ProcessRecord()
Expand Down
Loading