Skip to content

Commit a3ba189

Browse files
authored
Merge pull request Azure#4347 from haitch/preview
fix OperationalInsight searchResult backward compatible issue
2 parents 9ee1941 + d64ff27 commit a3ba189

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ function Test-SearchGetSearchResultsAndUpdate
3030
Assert-NotNull $searchResult.Value
3131
Assert-AreEqual $searchResult.Value.Count $top
3232

33+
# Makesure we return each doc as string for backward compatiable.
34+
$stringType = "string".GetType()
35+
$valueType = $searchResult.Value.GetType()
36+
$valueIsString = $valueType.GenericTypeArguments.Contains($stringType)
37+
Assert-AreEqual $true $valueIsString
38+
3339
$idArray = $searchResult.Id.Split("/")
3440
$id = $idArray[$idArray.Length-1]
3541
$updatedResult = Get-AzureRmOperationalInsightsSearchResults -ResourceGroupName $rgname -WorkspaceName $wsname -Id $id

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSSearchGetSearchResultsResponse.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using Microsoft.Azure.Management.OperationalInsights.Models;
1616
using System;
17+
using System.Linq;
1718
using System.Collections.Generic;
1819

1920
namespace Microsoft.Azure.Commands.OperationalInsights.Models
@@ -30,7 +31,7 @@ public PSSearchGetSearchResultsResponse(SearchResultsResponse response)
3031
{
3132
this.Id = response.Id;
3233
this.Metadata = new PSSearchMetadata(response.Metadata);
33-
this.Value = response.Value;
34+
this.Value = response.Value.Select(jObj=>jObj.ToString()).ToList();
3435

3536
if (response.Error != null)
3637
{

0 commit comments

Comments
 (0)