Skip to content

Commit c51eb8a

Browse files
wangbwnBoWangzi1
andauthored
Add linked service test case (#23813)
Co-authored-by: Bo Wang <[email protected]>
1 parent 0e96690 commit c51eb8a

File tree

5 files changed

+1297
-360
lines changed

5 files changed

+1297
-360
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"properties": {
3+
"annotations": [],
4+
"type": "SqlServer",
5+
"typeProperties": {
6+
"connectionString": "integrated security=False;data source=irservertest-manual6.database.windows.net;initial catalog=TEstDB;user id=asdfasdfasdfasdfasdf",
7+
}
8+
}
9+
}

src/DataFactory/DataFactoryV2.Test/ScenarioTests/LinkedServiceTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,12 @@ public void TestLinkedServiceWithResourceIdV2()
5151
{
5252
TestRunner.RunTestScript("Test-LinkedServiceWithResourceId");
5353
}
54+
55+
[Fact]
56+
[Trait(Category.AcceptanceType, Category.CheckIn)]
57+
public void TestLinkedServiceWithSqlServerV2()
58+
{
59+
TestRunner.RunTestScript("Test-LinkedService-SqlServer");
60+
}
5461
}
5562
}

src/DataFactory/DataFactoryV2.Test/ScenarioTests/LinkedServiceTests.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,35 @@ function Test-LinkedServicePiping
140140
CleanUp $rgname $dfname
141141
}
142142
}
143+
144+
<#
145+
.SYNOPSIS
146+
Creates a linked service and then does a Get to compare the results.
147+
Delete sthe created linked service at the end.
148+
#>
149+
function Test-LinkedService-SqlServer
150+
{
151+
$dfname = Get-DataFactoryName
152+
$rgname = Get-ResourceGroupName
153+
$rglocation = Get-ProviderLocation ResourceManagement
154+
$dflocation = Get-ProviderLocation DataFactoryManagement
155+
156+
New-AzResourceGroup -Name $rgname -Location $rglocation -Force
157+
158+
try
159+
{
160+
Set-AzDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Location $dflocation -Force
161+
162+
$lsname = "foo"
163+
$expected = Set-AzDataFactoryV2LinkedService -ResourceGroupName $rgname -DataFactoryName $dfname -Name $lsname -File .\Resources\linkedService-SqlServer.json -Force
164+
$actual = Get-AzDataFactoryV2LinkedService -ResourceGroupName $rgname -DataFactoryName $dfname -Name $lsname
165+
166+
Verify-AdfSubResource $expected $actual $rgname $dfname $lsname
167+
168+
Remove-AzDataFactoryV2LinkedService -ResourceGroupName $rgname -DataFactoryName $dfname -Name $lsname -Force
169+
}
170+
finally
171+
{
172+
CleanUp $rgname $dfname
173+
}
174+
}

0 commit comments

Comments
 (0)