Skip to content

Commit 439362b

Browse files
authored
[Az. ApplicationInsights] Add testcases for livetest (#20943)
* Add ApplicationInsights livetest * Delete blanks
1 parent b9ca3d2 commit 439362b

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Invoke-LiveTestScenario -Name "Create ApplicationInsights" -Description "Test New-AzApplicationInsights" -ScenarioScript `
2+
{
3+
param ($rg)
4+
5+
$rgName = $rg.ResourceGroupName
6+
$appName = New-LiveTestResourceName
7+
$appLocation = "westus"
8+
$appKind = "java"
9+
10+
$actual = New-AzApplicationInsights -Kind $appKind -ResourceGroupName $rgName -Name $appName -location $appLocation
11+
Assert-AreEqual $appName $actual.Name
12+
Assert-AreEqual $appLocation $actual.Location
13+
Assert-AreEqual $appKind $actual.Kind
14+
}
15+
16+
Invoke-LiveTestScenario -Name "List ApplicationInsights" -Description "Test listing ApplicationInsights" -ScenarioScript `
17+
{
18+
param ($rg)
19+
20+
$rgName = $rg.ResourceGroupName
21+
$appName = New-LiveTestResourceName
22+
$appLocation = "westus"
23+
$appKind = "java"
24+
25+
$null = New-AzApplicationInsights -Kind $appKind -ResourceGroupName $rgName -Name $appName -location $appLocation
26+
$actual = Get-AzApplicationInsights -ResourceGroupName $rgName
27+
Assert-AreEqual 1 $actual.Count
28+
}
29+
30+
Invoke-LiveTestScenario -Name "Get ApplicationInsights" -Description "Test getting one ApplicationInsights" -ScenarioScript `
31+
{
32+
param ($rg)
33+
34+
$rgName = $rg.ResourceGroupName
35+
$appName = New-LiveTestResourceName
36+
$appLocation = "westus"
37+
$appKind = "java"
38+
39+
$null = New-AzApplicationInsights -Kind $appKind -ResourceGroupName $rgName -Name $appName -location $appLocation
40+
$actual = Get-AzApplicationInsights -ResourceGroupName $rgName -Name $appName
41+
Assert-AreEqual $appName $actual.Name
42+
}
43+
44+
Invoke-LiveTestScenario -Name "Update ApplicationInsights" -Description "Test Updating one specific ApplicationInsights" -ScenarioScript `
45+
{
46+
param ($rg)
47+
48+
$rgName = $rg.ResourceGroupName
49+
$appName = New-LiveTestResourceName
50+
$appLocation = "westus"
51+
$appKind = "java"
52+
53+
$null = New-AzApplicationInsights -Kind $appKind -ResourceGroupName $rgName -Name $appName -location $appLocation
54+
$null = Update-AzApplicationInsights -ResourceGroupName $rgName -Name $appName -PublicNetworkAccessForIngestion "Disabled"
55+
$actual = Get-AzApplicationInsights -Name $appName -ResourceGroupName $rgName
56+
Assert-AreEqual $actual.PublicNetworkAccessForIngestion "Disabled"
57+
}
58+
59+
Invoke-LiveTestScenario -Name "Remove ApplicationInsights" -Description "Test Removing ApplicationInsights" -ScenarioScript `
60+
{
61+
param ($rg)
62+
63+
$rgName = $rg.ResourceGroupName
64+
$appName = New-LiveTestResourceName
65+
$appLocation = "westus"
66+
$appKind = "java"
67+
68+
$null = New-AzApplicationInsights -Kind $appKind -ResourceGroupName $rgName -Name $appName -location $appLocation
69+
Remove-AzApplicationInsights -ResourceGroupName $rgName -Name $appName
70+
$GetServiceList = Get-AzApplicationInsights -ResourceGroupName $rgName
71+
Assert-False { $GetServiceList.Name -contains $appName}
72+
}

0 commit comments

Comments
 (0)