Skip to content

Commit 306f052

Browse files
author
unknown
committed
Add cleaning up of resources created by the previous test runs
1 parent c3a5573 commit 306f052

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,56 @@ public TestContext TestContext
8989
public static void AssemblyInit(TestContext context)
9090
{
9191
SetTestSettings();
92+
93+
vmPowershellCmdlets = new ServiceManagementCmdletTestHelper();
94+
95+
try
96+
{
97+
vmPowershellCmdlets.RunPSScript("Get-AzureService | Remove-AzureService -Force");
98+
}
99+
catch
100+
{
101+
}
102+
103+
try
104+
{
105+
vmPowershellCmdlets.RunPSScript("Get-AzureDisk | Remove-AzureDisk");
106+
}
107+
catch
108+
{
109+
}
110+
111+
try
112+
{
113+
vmPowershellCmdlets.RunPSScript(@"Get-AzureVMImage | where {$_.Category -eq 'User'} | Remove-AzureVMImage");
114+
}
115+
catch
116+
{
117+
}
118+
119+
try
120+
{
121+
vmPowershellCmdlets.RunPSScript("Remove-AzureVNetConfig");
122+
}
123+
catch
124+
{
125+
}
126+
127+
try
128+
{
129+
vmPowershellCmdlets.RunPSScript("Get-AzureAffinityGroup | Remove-AzureAffinityGroup");
130+
}
131+
catch
132+
{
133+
}
134+
135+
try
136+
{
137+
vmPowershellCmdlets.RunPSScript("Get-AzureReservedIP | Remove-AzureReservedIP -Force");
138+
}
139+
catch
140+
{
141+
}
92142
}
93143

94144
[AssemblyCleanup]

0 commit comments

Comments
 (0)