Skip to content

[ADF] Adding Update-AzureRmDataFactoryV2 and Stop-AzureRmDataFactoryV2PipelineRun #5045

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 15 commits into from
Dec 6, 2017
Merged
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
9 changes: 8 additions & 1 deletion src/ResourceManager/DataFactories/AzureRM.DataFactoryV2.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ FunctionsToExport = @()
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport =
'Set-AzureRmDataFactoryV2',
'Update-AzureRmDataFactoryV2',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the change log with information about these two new cmdlets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

'Get-AzureRmDataFactoryV2',
'Remove-AzureRmDataFactoryV2',
'Set-AzureRmDataFactoryV2LinkedService',
Expand All @@ -94,6 +95,7 @@ CmdletsToExport =
'Remove-AzureRmDataFactoryV2Pipeline',
'Invoke-AzureRmDataFactoryV2Pipeline',
'Get-AzureRmDataFactoryV2PipelineRun',
'Stop-AzureRmDataFactoryV2PipelineRun',
'Get-AzureRmDataFactoryV2ActivityRun',
'Get-AzureRmDataFactoryV2IntegrationRuntimeKey',
'Get-AzureRmDataFactoryV2IntegrationRuntime',
Expand All @@ -115,7 +117,12 @@ CmdletsToExport =
# VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()
AliasesToExport =
'New-AzureRmDataFactoryV2',
'New-AzureRmDataFactoryV2Dataset',
'New-AzureRmDataFactoryV2LinkedService',
'New-AzureRmDataFactoryV2Pipeline',
'New-AzureRmDataFactoryV2Trigger'

# DSC resources to export from this module
# DscResourcesToExport = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,12 @@ public void TestGetFactoryByNameParameterSetV2()
{
RunPowerShellTest("Test-GetFactoryByNameParameterSet");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdateDataFactoryV2()
{
RunPowerShellTest("Test-UpdateDataFactory");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,34 @@ function Test-GetFactoryByNameParameterSet

Assert-ThrowsContains { Get-AzureRmDataFactoryV2 -DataFactoryName $dfname } "ResourceGroupName"
}

<#
.SYNOPSIS
Updates a data factory and then does a Get to verify that both are identical.
#>
function Test-UpdateDataFactory
{
$dfname = Get-DataFactoryName
$rgname = Get-ResourceGroupName
$rglocation = Get-ProviderLocation ResourceManagement
$dflocation = Get-ProviderLocation DataFactoryManagement

New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Force

try
{
Set-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Location $dflocation -Force
$actual = Update-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Tag @{newTag = "NewTagValue"}
$expected = Get-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname

Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual $expected.DataFactoryName $actual.DataFactoryName
Assert-AreEqual $expected.DataFactoryId $actual.DataFactoryId
Assert-AreEqual $expected.Tag $actual.Tag
}
finally
{
CleanUp $rgname $dfname
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ public void TestRunV2()
RunPowerShellTest("Test-Run");
}

[Fact]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for a successful cancellation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the run test to include it

[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCancelRunNegativeV2()
{
RunPowerShellTest("Test-CancelRunNegative");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function Test-Run
Set-AzureRmDataFactoryV2Pipeline -ResourceGroupName $rgname -Name $pipelineName -DataFactoryName $dfname -File ".\Resources\pipeline.json" -Force

$Run = Invoke-AzureRmDataFactoryV2Pipeline -ResourceGroupName $rgname -PipelineName $pipelineName -DataFactoryName $dfname -Parameter @{"OutputBlobName"="test";}

Assert-True { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -PipelineRunId $Run -DataFactoryName $dfname -PassThru}

# Trying get activity run.
Get-AzureRmDataFactoryV2ActivityRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run -RunStartedBefore $endDate -RunStartedAfter $startDate
Get-AzureRmDataFactoryV2ActivityRun -DataFactory $df -PipelineRunId $Run -RunStartedBefore $endDate -RunStartedAfter $startDate
Expand All @@ -56,4 +57,30 @@ function Test-Run
{
CleanUp $rgname $dfname
}
}
}

<#
.SYNOPSIS
Negative test for cancel pipeline run
#>
function Test-CancelRunNegative
{
$dfname = Get-DataFactoryName
$rgname = Get-ResourceGroupName
$rglocation = Get-ProviderLocation ResourceManagement
$dflocation = Get-ProviderLocation DataFactoryManagement

New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Force

try
{
Set-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Location $dflocation -Force

$Run = "someGuid"
Assert-ThrowsContains { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run } "Pipeline run does not exist"
}
finally
{
CleanUp $rgname $dfname
}
}
Loading