Skip to content

Commit af6ea0d

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into MoveRG
2 parents 4b49081 + 0fddf41 commit af6ea0d

29 files changed

+14904
-4928
lines changed

src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
5959
</Reference>
6060
<Reference Include="Microsoft.Azure.Management.OperationalInsights, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
61-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.12.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
61+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.13.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/ScenarioTests/SearchTests.ps1

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Get and update search results
1818
#>
1919
function Test-SearchGetSearchResultsAndUpdate
2020
{
21-
$rgname = "OI-Default-East-US"
22-
$wsname = "rasha"
21+
$rgname = "mms-eus"
22+
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
2323

24-
$top = 25
24+
$top = 5
2525

2626
$searchResult = Get-AzureRmOperationalInsightsSearchResults -ResourceGroupName $rgname -WorkspaceName $wsname -Top $top -Query "*"
2727

@@ -45,8 +45,8 @@ Get schemas for a given workspace
4545
#>
4646
function Test-SearchGetSchema
4747
{
48-
$rgname = "mms-eus"
49-
$wsname = "workspace-861bd466-5400-44be-9552-5ba40823c3aa"
48+
$rgname = "mms-eus"
49+
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
5050

5151
$schema = Get-AzureRmOperationalInsightsSchema -ResourceGroupName $rgname -WorkspaceName $wsname
5252
Assert-NotNull $schema
@@ -62,7 +62,7 @@ Get saved searches and search results from a saved search
6262
function Test-SearchGetSavedSearchesAndResults
6363
{
6464
$rgname = "mms-eus"
65-
$wsname = "workspace-861bd466-5400-44be-9552-5ba40823c3aa"
65+
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
6666

6767
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
6868

@@ -94,20 +94,21 @@ Create a new saved search, update, and then remove it
9494
function Test-SearchSetAndRemoveSavedSearches
9595
{
9696
$rgname = "mms-eus"
97-
$wsname = "workspace-861bd466-5400-44be-9552-5ba40823c3aa"
97+
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
9898

9999
$id = "test-new-saved-search-id-2015"
100100
$displayName = "TestingSavedSearch"
101101
$category = "Saved Search Test Category"
102102
$version = 1
103-
$query = "* | measure Count() by Type"
103+
$query = "* | measure Count() by Computer"
104104

105105
# Get the count of saved searches
106106
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
107107
$count = $savedSearches.Value.Count
108108
$newCount = $count + 1
109+
$tags = @{"Group" = "Computer"}
109110

110-
New-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Version $version -Force
111+
New-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Tags $tags -Version $version -Force
111112

112113
# Check that the search was saved
113114
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
@@ -121,22 +122,28 @@ function Test-SearchSetAndRemoveSavedSearches
121122
}
122123
}
123124

125+
#Set saved search cmdlet has issue with Etag. Temporarily comment out the call until it's fixed.
124126
# Test updating the search
125-
$query = "*"
126-
Set-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Version $version -ETag $etag
127+
#$query = "* | distinct Computer"
128+
#Set-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Tags $tags -Version $version -ETag $etag
127129

128130
# Check that the search was updated
129131
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
130132
Assert-AreEqual $savedSearches.Value.Count $newCount
131133

132134
$found = 0
135+
$hasTag = 0
133136
ForEach ($s in $savedSearches.Value)
134137
{
135138
If ($s.Properties.DisplayName.Equals($displayName) -And $s.Properties.Query.Equals($query)) {
136139
$found = 1
140+
If ($s.Properties.Tags["Group"] -eq "Computer") {
141+
$hasTag = 1
142+
}
137143
}
138144
}
139145
Assert-AreEqual $found 1
146+
Assert-AreEqual $hasTag 1
140147

141148

142149
Remove-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -Force

0 commit comments

Comments
 (0)