Skip to content

Commit d004c02

Browse files
authored
Merge pull request #5045 from hvermis/ADFv2
[ADF] Adding Update-AzureRmDataFactoryV2 and Stop-AzureRmDataFactoryV2PipelineRun
2 parents e552147 + 80492e9 commit d004c02

File tree

63 files changed

+2192
-301
lines changed

Some content is hidden

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

63 files changed

+2192
-301
lines changed

src/ResourceManager/DataFactories/AzureRM.DataFactoryV2.psd1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ FunctionsToExport = @()
7575
# 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.
7676
CmdletsToExport =
7777
'Set-AzureRmDataFactoryV2',
78+
'Update-AzureRmDataFactoryV2',
7879
'Get-AzureRmDataFactoryV2',
7980
'Remove-AzureRmDataFactoryV2',
8081
'Set-AzureRmDataFactoryV2LinkedService',
@@ -94,6 +95,7 @@ CmdletsToExport =
9495
'Remove-AzureRmDataFactoryV2Pipeline',
9596
'Invoke-AzureRmDataFactoryV2Pipeline',
9697
'Get-AzureRmDataFactoryV2PipelineRun',
98+
'Stop-AzureRmDataFactoryV2PipelineRun',
9799
'Get-AzureRmDataFactoryV2ActivityRun',
98100
'Get-AzureRmDataFactoryV2IntegrationRuntimeKey',
99101
'Get-AzureRmDataFactoryV2IntegrationRuntime',
@@ -115,7 +117,12 @@ CmdletsToExport =
115117
# VariablesToExport = @()
116118

117119
# 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.
118-
AliasesToExport = @()
120+
AliasesToExport =
121+
'New-AzureRmDataFactoryV2',
122+
'New-AzureRmDataFactoryV2Dataset',
123+
'New-AzureRmDataFactoryV2LinkedService',
124+
'New-AzureRmDataFactoryV2Pipeline',
125+
'New-AzureRmDataFactoryV2Trigger'
119126

120127
# DSC resources to export from this module
121128
# DscResourcesToExport = @()

src/ResourceManager/DataFactories/Commands.DataFactoryV2.Test/ScenarioTests/DataFactoryTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,12 @@ public void TestGetFactoryByNameParameterSetV2()
6565
{
6666
RunPowerShellTest("Test-GetFactoryByNameParameterSet");
6767
}
68+
69+
[Fact]
70+
[Trait(Category.AcceptanceType, Category.CheckIn)]
71+
public void TestUpdateDataFactoryV2()
72+
{
73+
RunPowerShellTest("Test-UpdateDataFactory");
74+
}
6875
}
6976
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2.Test/ScenarioTests/DataFactoryTests.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,34 @@ function Test-GetFactoryByNameParameterSet
146146

147147
Assert-ThrowsContains { Get-AzureRmDataFactoryV2 -DataFactoryName $dfname } "ResourceGroupName"
148148
}
149+
150+
<#
151+
.SYNOPSIS
152+
Updates a data factory and then does a Get to verify that both are identical.
153+
#>
154+
function Test-UpdateDataFactory
155+
{
156+
$dfname = Get-DataFactoryName
157+
$rgname = Get-ResourceGroupName
158+
$rglocation = Get-ProviderLocation ResourceManagement
159+
$dflocation = Get-ProviderLocation DataFactoryManagement
160+
161+
New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Force
162+
163+
try
164+
{
165+
Set-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Location $dflocation -Force
166+
$actual = Update-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Tag @{newTag = "NewTagValue"}
167+
$expected = Get-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname
168+
169+
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
170+
Assert-AreEqual $expected.DataFactoryName $actual.DataFactoryName
171+
Assert-AreEqual $expected.DataFactoryId $actual.DataFactoryId
172+
Assert-AreEqual $expected.Tag $actual.Tag
173+
}
174+
finally
175+
{
176+
CleanUp $rgname $dfname
177+
}
178+
}
179+

src/ResourceManager/DataFactories/Commands.DataFactoryV2.Test/ScenarioTests/RunTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,11 @@ public void TestRunV2()
3131
RunPowerShellTest("Test-Run");
3232
}
3333

34+
[Fact]
35+
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
public void TestCancelRunNegativeV2()
37+
{
38+
RunPowerShellTest("Test-CancelRunNegative");
39+
}
3440
}
3541
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2.Test/ScenarioTests/RunTests.ps1

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ function Test-Run
4343
Set-AzureRmDataFactoryV2Pipeline -ResourceGroupName $rgname -Name $pipelineName -DataFactoryName $dfname -File ".\Resources\pipeline.json" -Force
4444

4545
$Run = Invoke-AzureRmDataFactoryV2Pipeline -ResourceGroupName $rgname -PipelineName $pipelineName -DataFactoryName $dfname -Parameter @{"OutputBlobName"="test";}
46-
46+
Assert-True { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -PipelineRunId $Run -DataFactoryName $dfname -PassThru}
47+
4748
# Trying get activity run.
4849
Get-AzureRmDataFactoryV2ActivityRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run -RunStartedBefore $endDate -RunStartedAfter $startDate
4950
Get-AzureRmDataFactoryV2ActivityRun -DataFactory $df -PipelineRunId $Run -RunStartedBefore $endDate -RunStartedAfter $startDate
@@ -56,4 +57,30 @@ function Test-Run
5657
{
5758
CleanUp $rgname $dfname
5859
}
59-
}
60+
}
61+
62+
<#
63+
.SYNOPSIS
64+
Negative test for cancel pipeline run
65+
#>
66+
function Test-CancelRunNegative
67+
{
68+
$dfname = Get-DataFactoryName
69+
$rgname = Get-ResourceGroupName
70+
$rglocation = Get-ProviderLocation ResourceManagement
71+
$dflocation = Get-ProviderLocation DataFactoryManagement
72+
73+
New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Force
74+
75+
try
76+
{
77+
Set-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Location $dflocation -Force
78+
79+
$Run = "someGuid"
80+
Assert-ThrowsContains { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run } "Pipeline run does not exist"
81+
}
82+
finally
83+
{
84+
CleanUp $rgname $dfname
85+
}
86+
}

0 commit comments

Comments
 (0)