Skip to content

Commit 0b3f6d6

Browse files
author
Wan Yang
committed
fix NewAzureSynapseSparkPool for auto scale
1 parent 4832c5f commit 0b3f6d6

File tree

4 files changed

+975
-355
lines changed

4 files changed

+975
-355
lines changed

src/Synapse/Synapse.Test/ScenarioTests/SparkPoolTests.ps1

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ function Test-SynapseSparkPool
99
$resourceGroupName = (Get-ResourceGroupName),
1010
$workspaceName = (Get-SynapseWorkspaceName),
1111
$sparkPoolName = (Get-SynapseSparkPoolName),
12+
$sparkPoolName1 = $sparkPoolName + "1",
1213
$sparkPoolNodeCount = 3,
14+
$sparkAutoScaleMinNodeCount = 3,
15+
$sparkAutoScaleMaxNodeCount = 6,
1316
$sparkPoolNodeSize = "Small",
1417
$sparkVersion = 2.4
1518
)
@@ -24,13 +27,22 @@ function Test-SynapseSparkPool
2427
# Test to make sure the SparkPool doesn't exist
2528
Assert-False {Test-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName}
2629

27-
$sparkPoolCreated = New-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -NodeCount $sparkPoolNodeCount -SparkVersion $sparkVersion -NodeSize $sparkPoolNodeSize
30+
# EnableAutoScale
31+
$sparkPoolCreated1 = New-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -NodeCount $sparkPoolNodeCount -SparkVersion $sparkVersion -NodeSize $sparkPoolNodeSize
2832

29-
Assert-AreEqual $sparkPoolName $sparkPoolCreated.Name
30-
Assert-AreEqual $location $sparkPoolCreated.Location
31-
Assert-AreEqual "Microsoft.Synapse/Workspaces/bigDataPools" $sparkPoolCreated.Type
32-
Assert-True {$sparkPoolCreated.Id -like "*$resourceGroupName*"}
33+
Assert-AreEqual $sparkPoolName $sparkPoolCreated1.Name
34+
Assert-AreEqual $location $sparkPoolCreated1.Location
35+
Assert-AreEqual "Microsoft.Synapse/Workspaces/bigDataPools" $sparkPoolCreated1.Type
36+
Assert-True {$sparkPoolCreated1.Id -like "*$resourceGroupName*"}
3337

38+
# just test create for UnableAutoScale
39+
$sparkPoolCreated2 = New-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName1 -AutoScaleMinNodeCount $sparkAutoScaleMinNodeCount -AutoScaleMaxNodeCount $sparkAutoScaleMaxNodeCount -SparkVersion $sparkVersion -NodeSize $sparkPoolNodeSize
40+
41+
Assert-AreEqual $sparkPoolName1 $sparkPoolCreated2.Name
42+
Assert-AreEqual $location $sparkPoolCreated2.Location
43+
Assert-AreEqual "Microsoft.Synapse/Workspaces/bigDataPools" $sparkPoolCreated2.Type
44+
Assert-True {$sparkPoolCreated2.Id -like "*$resourceGroupName*"}
45+
3446
# In loop to check if Spark pool exists
3547
for ($i = 0; $i -le 60; $i++)
3648
{
@@ -40,7 +52,7 @@ function Test-SynapseSparkPool
4052
Assert-AreEqual $sparkPoolName $sparkPoolGet[0].Name
4153
Assert-AreEqual $location $sparkPoolGet[0].Location
4254
Assert-AreEqual "Microsoft.Synapse/Workspaces/bigDataPools" $sparkPoolGet[0].Type
43-
Assert-True {$sparkPoolCreated.Id -like "*$resourceGroupName*"}
55+
Assert-True {$sparkPoolCreated1.Id -like "*$resourceGroupName*"}
4456
break
4557
}
4658

@@ -114,6 +126,7 @@ function Test-SynapseSparkPool
114126

115127
# Delete SparkPool
116128
Assert-True {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -PassThru} "Remove SparkPool failed."
129+
Assert-True {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName1 -PassThru} "Remove SparkPool failed."
117130

118131
# Verify that it is gone by trying to get it again
119132
Assert-Throws {Get-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName}
@@ -122,5 +135,6 @@ function Test-SynapseSparkPool
122135
{
123136
# cleanup the spark pool that was used in case it still exists. This is a best effort task, we ignore failures here.
124137
Invoke-HandledCmdlet -Command {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -ErrorAction SilentlyContinue} -IgnoreFailures
138+
Invoke-HandledCmdlet -Command {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName1 -ErrorAction SilentlyContinue} -IgnoreFailures
125139
}
126140
}

0 commit comments

Comments
 (0)