From 1613e3e9d3c48987f1de6beda03ce495d0d34704 Mon Sep 17 00:00:00 2001 From: Maoliang Huang Date: Mon, 17 Apr 2023 20:06:18 +0000 Subject: [PATCH 1/4] Add more test cases --- .../AzPredictorTelemetryTests.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs b/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs index b5f225623890..f7d80023f60d 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs @@ -55,6 +55,10 @@ public AzPredictorTelemetryTests(ModelFixture modelFixture) [InlineData(@"C:\Users\MyName\exe")] [InlineData(@"az storage")] [InlineData(@"get")] + [InlineData(@"-StorageAccountKey""xxx""NewAzStorageContainer -context xxx")] + [InlineData(@"-StorageAccountKey""xxx""New-AzStorageContainer -context xxx")] + [InlineData(@"New-AzureStorageContext-StorageAccountName ""xxx"" -StorageAccountKey ""xxx""")] + [InlineData(@"sig=xxxxxxxxxxx/Sensor-Azure")] public async Task VerifyOnCommandLineAcceptedForOneUnsupportedCommandHistory(string inputData) { var expectedTelemetryCount = 2; @@ -556,8 +560,12 @@ public async Task VerifyOnCommandLineAcceptedException() [InlineData("Set-Az", "Set-Az")] [InlineData("Get-azR", "Get-azR")] [InlineData("start_of_snippet", "NonVerb-AzResource")] - [InlineData("start_of_snippet", "Get")] - [InlineData("start_of_snippet", "Set-")] + [InlineData("Get", "Get")] + [InlineData("Set-", "Set-")] + [InlineData("start_of_snippet", @"-StorageAccountKey""xxx""NewAzStorageContainer -context xxx")] + [InlineData("start_of_snippet", @"-StorageAccountKey""xxx""New-AzStorageContainer -context xxx")] + [InlineData("start_of_snippet", @"New-AzureStorageContext-StorageAccountName ""xxx"" -StorageAccountKey ""xxx""")] + [InlineData("start_of_snippet", @"sig=xxxxxxxxxxx/Sensor-Azure")] public void VerifyUserInputInGetSuggestionEvent(string expectedUserInput, string input) { var expectedTelemetryCount = 1; From 634945b19d3650c70a126214f47cac6a3469a557 Mon Sep 17 00:00:00 2001 From: Maoliang Huang Date: Wed, 19 Apr 2023 20:34:23 +0000 Subject: [PATCH 2/4] Rename the two property names --- .../Az.Tools.Predictor/Telemetry/GetSuggestionTelemetryData.cs | 2 +- .../Az.Tools.Predictor/Telemetry/HistoryTelemetryData.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/GetSuggestionTelemetryData.cs b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/GetSuggestionTelemetryData.cs index 80981bf123e9..c7f634454792 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/GetSuggestionTelemetryData.cs +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/GetSuggestionTelemetryData.cs @@ -36,7 +36,7 @@ public sealed class GetSuggestionTelemetryData : ITelemetryData /// /// The telemetry property name for "Prediction". /// - public const string PropertyNamePrediction = "Prediction"; + public const string PropertyNamePrediction = "Prediction2"; /// /// The telemetry property name for "SuggestionSessionId". diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/HistoryTelemetryData.cs b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/HistoryTelemetryData.cs index bc441e3a7f6e..39df2372bb67 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/HistoryTelemetryData.cs +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Telemetry/HistoryTelemetryData.cs @@ -24,7 +24,7 @@ public sealed class HistoryTelemetryData : ITelemetryData /// /// The telemetry property name for "Command". /// - public const string PropertyNameCommand = "Command"; + public const string PropertyNameCommand = "Command2"; /// /// The telemetry property name for "Success". From 8241b432d395e94b8f39ca1f8fffe39dadb2b2b3 Mon Sep 17 00:00:00 2001 From: Maoliang Huang Date: Thu, 20 Apr 2023 16:00:54 +0000 Subject: [PATCH 3/4] Update the version --- .../Az.Tools.Predictor/Az.Tools.Predictor.psd1 | 2 +- tools/Az.Tools.Predictor/Az.Tools.Predictor/ChangeLog.md | 3 +++ tools/Az.Tools.Predictor/Directory.Build.props | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 index 9e702b3e6006..56c4a8e25f7b 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 @@ -11,7 +11,7 @@ RootModule = 'Az.Tools.Predictor.psm1' # Version number of this module. -ModuleVersion = '1.1.0' +ModuleVersion = '1.1.1' # Supported PSEditions CompatiblePSEditions = 'Core' diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor/ChangeLog.md b/tools/Az.Tools.Predictor/Az.Tools.Predictor/ChangeLog.md index 4d7e4d05fcdf..228b4791a573 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor/ChangeLog.md +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor/ChangeLog.md @@ -19,6 +19,9 @@ --> ## Upcoming Release +## Version 1.1.1 +* Updated data collection mechanism + ## Version 1.1.0 * Updated data collection mechanism diff --git a/tools/Az.Tools.Predictor/Directory.Build.props b/tools/Az.Tools.Predictor/Directory.Build.props index ca534589d0b5..36f0cb7612db 100644 --- a/tools/Az.Tools.Predictor/Directory.Build.props +++ b/tools/Az.Tools.Predictor/Directory.Build.props @@ -4,7 +4,7 @@ net6.0 false true - 1.1.0 + 1.1.1 Microsoft Corporation Microsoft Corporation Microsoft Corporation. All rights reserved. From 079176bd4cc86c3347d97d9c6368b9cd0f7424a5 Mon Sep 17 00:00:00 2001 From: Maoliang Huang Date: Thu, 20 Apr 2023 10:30:36 -0700 Subject: [PATCH 4/4] Add more test cases --- .../Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs b/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs index f7d80023f60d..463e028f212d 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor.Test/AzPredictorTelemetryTests.cs @@ -56,9 +56,11 @@ public AzPredictorTelemetryTests(ModelFixture modelFixture) [InlineData(@"az storage")] [InlineData(@"get")] [InlineData(@"-StorageAccountKey""xxx""NewAzStorageContainer -context xxx")] + [InlineData(@"-StorageAccountKey\""xxx\""NewAzStorageContainer -context xxx")] [InlineData(@"-StorageAccountKey""xxx""New-AzStorageContainer -context xxx")] [InlineData(@"New-AzureStorageContext-StorageAccountName ""xxx"" -StorageAccountKey ""xxx""")] [InlineData(@"sig=xxxxxxxxxxx/Sensor-Azure")] + [InlineData(@"sig=Signature/Test-Sensor-Azu")] public async Task VerifyOnCommandLineAcceptedForOneUnsupportedCommandHistory(string inputData) { var expectedTelemetryCount = 2; @@ -155,6 +157,7 @@ public async Task VerifyOnCommandLineAcceptedForOneSupportedCommandWithoutParame [InlineData("Get-AzRoleAssignment -ObjectId ***", "Remove-AzRoleAssignment -RoleDefinitionId (Get-AzRoleAssignment -ObjectId xxxx)")] [InlineData("Get-AzResourceGroup -Location:***", "Get-AzResourceGroup rg1 -Location:WestUS3")] [InlineData("Get-AzResourceGroup", "Get-AzResourceGroup rg1 WestUS3")] + [InlineData("New-AzureStorageContext -StorageAccountKey *** -StorageAccountName ***", @"New-AzureStorageContext -StorageAccountName ""accountName"" -StorageAccountKey ""accountKey""")] public async Task VerifyOnCommandLineAcceptedForOneSupportedCommandWithParameter(string expectedValue, string inputData) { var expectedTelemetryCount = 2; @@ -562,10 +565,13 @@ public async Task VerifyOnCommandLineAcceptedException() [InlineData("start_of_snippet", "NonVerb-AzResource")] [InlineData("Get", "Get")] [InlineData("Set-", "Set-")] + [InlineData("New-AzureStorageContext -StorageAccountKey *** -StorageAccountName ***", @"New-AzureStorageContext -StorageAccountName ""accountName"" -StorageAccountKey ""accountKey""")] [InlineData("start_of_snippet", @"-StorageAccountKey""xxx""NewAzStorageContainer -context xxx")] + [InlineData("start_of_snippet", @"-StorageAccountKey\""xxx\""NewAzStorageContainer -context xxx")] [InlineData("start_of_snippet", @"-StorageAccountKey""xxx""New-AzStorageContainer -context xxx")] [InlineData("start_of_snippet", @"New-AzureStorageContext-StorageAccountName ""xxx"" -StorageAccountKey ""xxx""")] [InlineData("start_of_snippet", @"sig=xxxxxxxxxxx/Sensor-Azure")] + [InlineData("start_of_snippet", @"sig=Signature/Test-Sensor-Azu")] public void VerifyUserInputInGetSuggestionEvent(string expectedUserInput, string input) { var expectedTelemetryCount = 1;