Skip to content

Fix usability bugs in Get-AzureRmOperationalInsightsSearchResults #3343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ResourceManager/OperationalInsights/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Current Release
* Get-AzureRmOperationalInsightsSearchResults no longer requires the Top parameter to retrieve results

## Version 2.4.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.OperationalInsights.Test.SearchTests\TestSearchSetAndRemoveSavedSearches.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.OperationalInsights.Test.StorageInsightTests\TestStorageInsightCreateFailsWithoutWorkspace.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.OperationalInsights.Test.StorageInsightTests\TestStorageInsightCreateFailsNoWs.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.OperationalInsights.Test.StorageInsightTests\TestStorageInsightCreateUpdateDelete.json">
Expand All @@ -243,4 +243,4 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public void TestStorageInsightCreateUpdateDelete()

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStorageInsightCreateFailsWithoutWorkspace()
public void TestStorageInsightCreateFailsNoWs()
{
RunPowerShellTest("Test-StorageInsightCreateFailsWithoutWorkspace");
RunPowerShellTest("Test-StorageInsightCreateFailsNoWs");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function Test-StorageInsightCreateUpdateDelete
.SYNOPSIS
Validate that storage insight creation fails without a valid parent workspace
#>
function Test-StorageInsightCreateFailsWithoutWorkspace
function Test-StorageInsightCreateFailsNoWs
{
$wsname = Get-ResourceName
$siname = Get-ResourceName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
}
],
"Names": {
"Test-StorageInsightCreateFailsWithoutWorkspace": [
"Test-StorageInsightCreateFailsNoWs": [
"onesdk4327",
"onesdk2618",
"onesdk7042",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ public virtual PSSearchGetSchemaResponse GetSchema(string resourceGroupName, str
public virtual PSSearchGetSearchResultsResponse GetSearchResults(string resourceGroupName, string workspaceName, PSSearchGetSearchResultsParameters psParameters)
{
SearchGetSearchResultsParameters parameters = new SearchGetSearchResultsParameters();
parameters.Top = psParameters.Top;

if (psParameters.Highlight != null)
{
parameters.Highlight = new Highlight();
parameters.Highlight.Pre = psParameters.Highlight.Pre;
parameters.Highlight.Post = psParameters.Highlight.Post;
}

parameters.Top = psParameters.Top == 0 ? 10 : psParameters.Top;
parameters.Query = psParameters.Query;
parameters.Start = psParameters.Start;
parameters.End = psParameters.End;
parameters.End = psParameters.End.GetValueOrDefault(DateTime.UtcNow);

SearchGetSearchResultsResponse response = OperationalInsightsManagementClient.Search.GetSearchResults(resourceGroupName, workspaceName, parameters);
PSSearchGetSearchResultsResponse searchResponse = new PSSearchGetSearchResultsResponse(response);
Expand Down
Loading