Skip to content

Commit 77f543f

Browse files
authored
Merge pull request Azure#3184 from lwang2016/dev
Fix Set-AzureRmOperationalInsightsSavedSearch ETag
2 parents 857311f + b0914a8 commit 77f543f

File tree

4 files changed

+721
-95
lines changed

4 files changed

+721
-95
lines changed

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

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

2424
$top = 5
@@ -45,9 +45,15 @@ Get schemas for a given workspace
4545
#>
4646
function Test-SearchGetSchema
4747
{
48-
$rgname = "mms-eus"
49-
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
48+
$wsname = Get-ResourceName
49+
$dsName = Get-ResourceName
50+
$rgname = Get-ResourceGroupName
51+
$wslocation = Get-ProviderLocation
52+
53+
New-AzureRmResourceGroup -Name $rgname -Location $wslocation -Force
5054

55+
# Create a workspace to house the data sources
56+
$workspace = New-AzureRmOperationalInsightsWorkspace -ResourceGroupName $rgname -Name $wsname -Location $wslocation -Sku premium -Force
5157
$schema = Get-AzureRmOperationalInsightsSchema -ResourceGroupName $rgname -WorkspaceName $wsname
5258
Assert-NotNull $schema
5359
Assert-NotNull $schema.Metadata
@@ -61,7 +67,7 @@ Get saved searches and search results from a saved search
6167
#>
6268
function Test-SearchGetSavedSearchesAndResults
6369
{
64-
$rgname = "mms-eus"
70+
$rgname = "mms-eus"
6571
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
6672

6773
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
@@ -93,8 +99,15 @@ Create a new saved search, update, and then remove it
9399
#>
94100
function Test-SearchSetAndRemoveSavedSearches
95101
{
96-
$rgname = "mms-eus"
97-
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"
102+
$wsname = Get-ResourceName
103+
$dsName = Get-ResourceName
104+
$rgname = Get-ResourceGroupName
105+
$wslocation = Get-ProviderLocation
106+
107+
New-AzureRmResourceGroup -Name $rgname -Location $wslocation -Force
108+
109+
# Create a workspace to house the data sources
110+
$workspace = New-AzureRmOperationalInsightsWorkspace -ResourceGroupName $rgname -Name $wsname -Location $wslocation -Sku premium -Force
98111

99112
$id = "test-new-saved-search-id-2015"
100113
$displayName = "TestingSavedSearch"
@@ -124,8 +137,8 @@ function Test-SearchSetAndRemoveSavedSearches
124137

125138
#Set saved search cmdlet has issue with Etag. Temporarily comment out the call until it's fixed.
126139
# Test updating the search
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
140+
$query = "* | distinct Computer"
141+
Set-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Tags $tags -Version $version -ETag $etag
129142

130143
# Check that the search was updated
131144
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname

src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/SessionRecords/Microsoft.Azure.Commands.OperationalInsights.Test.SearchTests/TestSearchGetSchema.json

Lines changed: 256 additions & 15 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)