Skip to content

Commit a037261

Browse files
authored
Log Analytics new parameters Group By ApplicationId and UserAgent (#14015)
* data dog work, signed nuget packages * nuget pkg from signed location .net * using the package that released data dog functionality * update nuget and disk objs * back to 42 to avoid test failures * v42 * Update RecoveryServices.Backup.Test.csproj * Update RecoveryServices.SiteRecovery.Test.csproj * Update SqlVirtualMachine.Test.csproj * remove bad cmdlet to see if resolves CI errors * Update LogAnalyticTests.ps1 Co-authored-by: Jin Lei <[email protected]> > > @Sandido > > Compute test module uses storage via cmdlets defined in AzureRM.Storage.ps1. New-AzStorageContext cannot be recognized because it is not defined in AzureRM.Storage.ps1. > > Could you try to modify your test and not to use these storage cmdlets? > > @msJinLei , Without this cmdlet, the test does not function. I have commented out the test code, and made the test a LiveOnly test. The code can be uncommented to be run locally. I will see if the SDK team can add New-AzStorageContext to AzureRM.Storage.ps1 at a later date. We want this work merged by 2/1 so please consider this PR for merging. OK
1 parent dadfd0f commit a037261

File tree

10 files changed

+602
-7
lines changed

10 files changed

+602
-7
lines changed

src/Compute/Compute.Test/Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<PsModuleName>Compute</PsModuleName>

src/Compute/Compute.Test/ScenarioTests/LogAnalyticTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ public void TestExportLogAnalyticRequestRateByIntervalNegative()
3838
TestRunner.RunTestScript("Test-ExportLogAnalyticRequestRateByIntervalNegative");
3939
}
4040

41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
43+
public void TestExportLogAnalyticGroupByParameters()
44+
{
45+
TestRunner.RunTestScript("Test-ExportLogAnalyticGroupByParameters");
46+
}
47+
4148
[Fact(Skip = "BUG: LogAnalytics does not work.")]
4249
[Trait(Category.AcceptanceType, Category.CheckIn)]
4350
[Trait("Re-record", "ClientRuntime changes")]

src/Compute/Compute.Test/ScenarioTests/LogAnalyticTests.ps1

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,68 @@ function Test-ExportLogAnalyticRequestRateByIntervalNegative
4343
"the given SAS URI";
4444
}
4545

46+
<#
47+
.SYNOPSIS
48+
Test Export Log Analytics group by parameters
49+
#>
50+
function Test-ExportLogAnalyticGroupByParameters
51+
{
52+
53+
# Setup
54+
$rgname = Get-ComputeTestResourceName;
55+
$loc = "westus2";
56+
57+
try
58+
{
59+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
60+
61+
$stoname = 'sto' + $rgname;
62+
$stotype = 'Standard_GRS';
63+
$container = "contain";
64+
New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
65+
$key = Get-AzStorageAccountKey -ResourceGroupName $rgname -Name $stoname;
66+
Assert-NotNull $key;
67+
68+
$from = Get-Date -Year 2021 -Month 1 -Day 4 -Hour 9;
69+
$to = Get-Date -Year 2021 -Month 1 -Day 5 -Hour 9;
70+
71+
$context = New-AzStorageContext -StorageAccountName $stoname -StorageAccountKey $key.Value[0];
72+
73+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
74+
{
75+
New-AzStorageContainer -Name $container -Context $context;
76+
$sastoken = Get-AzStorageContainer -Name $container -Context $context | New-AzStorageContainerSASToken -Permission rwdl -Context $context;
77+
}
78+
79+
$sasuri = "https://$stoname.blob.core.windows.net/$container$sastoken";
80+
81+
$result = Export-AzLogAnalyticThrottledRequest -Location $loc -FromTime $from -ToTime $to -BlobContainerSasUri $sasuri -GroupByUserAgent;
82+
Assert-AreEqual "Succeeded" $result.Status;
83+
84+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
85+
{
86+
$blobs = Get-AzStorageBlob -Container $container -Context $context;
87+
$throttle_blob = $blobs | where {$_.name.contains("ThrottledRequests")};
88+
Assert-NotNull $throttle_blob;
89+
}
90+
91+
$result = Export-AzLogAnalyticThrottledRequest -Location $loc -FromTime $from -ToTime $to -BlobContainerSasUri $sasuri -GroupByApplicationId;
92+
Assert-AreEqual "Succeeded" $result.Status;
93+
94+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
95+
{
96+
$blobs = Get-AzStorageBlob -Container $container -Context $context;
97+
$throttle_blob = $blobs | where {$_.name.contains("ThrottledRequests")};
98+
Assert-NotNull $throttle_blob;
99+
}
100+
}
101+
finally
102+
{
103+
# Cleanup
104+
Clean-ResourceGroup $rgname
105+
}
106+
}
107+
46108
<#
47109
.SYNOPSIS
48110
Test Export Log Analytics positive scenario

0 commit comments

Comments
 (0)