Skip to content

Commit fe1c530

Browse files
author
maddieclayton
authored
Merge pull request #5206 from shutchings/preview
Machine Learning Compute: Add -IncludeAllResources Paramter for Remove cmdlet
2 parents af4a016 + e0a9dcc commit fe1c530

File tree

14 files changed

+351903
-72306
lines changed

14 files changed

+351903
-72306
lines changed

src/ResourceManager/MachineLearningCompute/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Add IncludeAllResources parameter to Remove-AzureRmMlOpCluster cmdlet
22+
- Using this switch parameter will remove all resources that were created with the cluster originally
2123
* Added Location Completer to -Location parameters allowing tab completion through valid Locations
2224
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription
2325

src/ResourceManager/MachineLearningCompute/Commands.MachineLearningCompute.Test/Commands.MachineLearningCompute.Test.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<Private>True</Private>
6161
</Reference>
6262
<Reference Include="Microsoft.Azure.Management.MachineLearningCompute, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
63-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.MachineLearningCompute.0.2.0\lib\net452\Microsoft.Azure.Management.MachineLearningCompute.dll</HintPath>
63+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.MachineLearningCompute.0.3.0\lib\net452\Microsoft.Azure.Management.MachineLearningCompute.dll</HintPath>
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
@@ -173,6 +173,9 @@
173173
<None Include="SessionRecords\Microsoft.Azure.Commands.MachineLearningCompute.Test.ScenarioTests.MLCTests\TestNewGetRemove.json">
174174
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
175175
</None>
176+
<None Include="SessionRecords\Microsoft.Azure.Commands.MachineLearningCompute.Test.ScenarioTests.MLCTests\TestRemoveIncludeAllResources.json">
177+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
178+
</None>
176179
<None Include="SessionRecords\Microsoft.Azure.Commands.MachineLearningCompute.Test.ScenarioTests.MLCTests\TestSet.json">
177180
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
178181
</None>

src/ResourceManager/MachineLearningCompute/Commands.MachineLearningCompute.Test/ScenarioTests/MLCTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,12 @@ public void TestSet()
4343
{
4444
TestController.NewInstance.RunPsTest(this.interceptor, "Test-Set");
4545
}
46+
47+
[Fact]
48+
[Trait(Category.AcceptanceType, Category.CheckIn)]
49+
public void TestRemoveIncludeAllResources()
50+
{
51+
TestController.NewInstance.RunPsTest(this.interceptor, "Test-RemoveIncludeAllResources");
52+
}
4653
}
4754
}

src/ResourceManager/MachineLearningCompute/Commands.MachineLearningCompute.Test/ScenarioTests/MLCTests.ps1

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Creates a local operationalization cluster for use in tests.
3939
function GetDefaultLocalClusterProperties
4040
{
4141
$location = "East US 2 EUAP"
42-
$clusterType = "West Central US"
42+
$clusterType = "Local"
4343
$description = "Deployed from powershell"
4444

4545
$cluster = New-Object Microsoft.Azure.Management.MachineLearningCompute.Models.OperationalizationCluster `
@@ -302,4 +302,27 @@ function Test-Set
302302

303303
# Cleanup
304304
TeardownTest -ResourceGroupName $resourceGroupName
305-
}
305+
}
306+
307+
function Test-RemoveIncludeAllResources
308+
{
309+
$resourceGroupName = GetUniqueName("mlcrp-cmdlet-test-remove-all")
310+
$clusterName = GetUniqueName("mlcrp-cmdlet-test-remove-all")
311+
312+
SetupTest $resourceGroupName
313+
314+
# Create the cluster
315+
$cluster = GetDefaultLocalClusterProperties
316+
$createdCluster = New-AzureRmMlOpCluster -ResourceGroupName $resourceGroupName -Name $clusterName -Cluster $cluster
317+
318+
# Get the managed by resource group name before deleting
319+
$managedByResourceGroupName = GetManagedByResourceGroupName -ResourceGroupName $resourceGroupName
320+
321+
# Delete the cluster
322+
Remove-AzureRmMlOpCluster -ResourceGroupName $resourceGroupName -Name $clusterName -IncludeAllResources
323+
324+
Assert-Throws ( Get-AzureRmResourceGroup -ResourceGroupName $managedByResourceGroupName )
325+
326+
# Cleanup
327+
Remove-AzureRmResourceGroup -ResourceGroupName $resourceGroupName -Force
328+
}

src/ResourceManager/MachineLearningCompute/Commands.MachineLearningCompute.Test/SessionRecords/Microsoft.Azure.Commands.MachineLearningCompute.Test.ScenarioTests.MLCTests/TestNewGetRemove.json

Lines changed: 260011 additions & 72280 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)