benchpress/examples/OperationalInsightsWorkspace/OperationalInsightsWorkspac...

69 строки
2.2 KiB
PowerShell
Исходник Постоянная ссылка Обычный вид История

BeforeAll {
Import-Module BenchPress.Azure
2023-03-23 23:12:29 +03:00
$Script:rgName = 'rg-test'
$Script:oiwName = 'oiwName'
$Script:noOiwName = 'noOiwName'
2023-03-23 23:12:29 +03:00
$Script:location = 'westus3'
}
Describe 'Verify Operational Insights Workspace Exists' {
It "Should contain an Operational Insights Workspace named $oiwName - Confirm-AzBPResource" {
# arrange
2023-03-23 23:12:29 +03:00
$params = @{
ResourceType = "OperationalInsightsWorkspace"
ResourceGroupName = $rgName
ResourceName = $oiwName
}
# act and assert
Confirm-AzBPResource @params | Should -BeSuccessful
}
It "Should contain an Operational Insights Workspace named $oiwName - Confirm-AzBPResource" {
# arrange
2023-03-23 23:12:29 +03:00
$params = @{
ResourceType = "OperationalInsightsWorkspace"
ResourceGroupName = $rgName
ResourceName = $oiwName
PropertyKey = 'Name'
PropertyValue = $oiwName
}
# act and assert
Confirm-AzBPResource @params | Should -BeSuccessful
2023-03-23 23:12:29 +03:00
}
It "Should contain an Operational Insights Workspace named $oiwName" {
Confirm-AzBPOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $oiwName | Should -BeSuccessful
2023-03-23 23:12:29 +03:00
}
2023-03-24 23:47:58 +03:00
It "Should not contain an Operational Insights Workspace named $noOiwName" {
# arrange
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
$params = @{
ResourceGroupName = $rgName
Name = $noOiwName
ErrorAction = "SilentlyContinue"
}
# act and asssert
Confirm-AzBPOperationalInsightsWorkspace @params | Should -Not -BeSuccessful
}
It "Should contain an Operational Insights Workspace named $oiwName in $location" {
Confirm-AzBPOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $oiwName | Should -BeInLocation $location
}
It "Should contain an Operational Insights Workspace named $oiwName in $rgName" {
Confirm-AzBPOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $oiwName
| Should -BeInResourceGroup $rgName
}
}
2023-03-24 23:52:36 +03:00
AfterAll {
Get-Module BenchPress.Azure | Remove-Module
}