diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs index 16ec364fc6b..aeda1e15698 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs @@ -52,7 +52,7 @@ public async Task PlaybackLogsSanitizedRequest() HttpResponse response = new DefaultHttpContext().Response; await testRecordingHandler.HandlePlaybackRequest(recordingId, request, response); - AssertLogs(logger); + AssertLogs(logger, 1); } finally { @@ -92,7 +92,7 @@ public async Task RecordingHandlerLogsSanitizedRequests() try { - AssertLogs(logger); + AssertLogs(logger, 0); } finally { @@ -101,27 +101,27 @@ public async Task RecordingHandlerLogsSanitizedRequests() } } - private static void AssertLogs(TestLogger logger) + private static void AssertLogs(TestLogger logger, int logOffSet) { - Assert.Equal(5, logger.Logs.Count); + Assert.Equal(4 + logOffSet, logger.Logs.Count); Assert.Equal( $"URI: [ http://127.0.0.1:5000/admin/addsanitizer]{Environment.NewLine}Headers: " + "[{\"Host\":[\"127.0.0.1:5000\"],\"x-abstraction-identifier\":[\"HeaderRegexSanitizer\"]," + "\"Content-Length\":[\"92\"]}]" + Environment.NewLine, - logger.Logs[1].ToString()); + logger.Logs[0 + logOffSet].ToString()); Assert.Equal( "Request Body Content{\"key\":\"Location\",\"value\":\"https://fakeazsdktestaccount.table.core.windows.net/Tables\"}", - logger.Logs[2].ToString()); + logger.Logs[1 + logOffSet].ToString()); // sanitizer request body is currently duplicated for each key/value pair Assert.Equal( "Request Body Content{\"key\":\"Location\",\"value\":\"https://fakeazsdktestaccount.table.core.windows.net/Tables\"}", - logger.Logs[3].ToString()); + logger.Logs[2 + logOffSet].ToString()); Assert.Equal("URI: [ https://fakeazsdktestaccount.table.core.windows.net/Tables]" + Environment.NewLine + "Headers: [{\"Accept\":[\"application/json;odata=minimalmetadata\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Authorization\":[\"Sanitized\"],\"Connection\":[\"keep-alive\"]," + "\"Content-Length\":[\"12\"],\"Content-Type\":[\"application/octet-stream\"],\"DataServiceVersion\":[\"3.0\"],\"Date\":[\"Tue, 18 May 2021 23:27:42 GMT\"]," + "\"User-Agent\":[\"azsdk-python-data-tables/12.0.0b7 Python/3.8.6 (Windows-10-10.0.19041-SP0)\"],\"x-ms-client-request-id\":[\"a4c24b7a-b830-11eb-a05e-10e7c6392c5a\"]," + "\"x-ms-date\":[\"Tue, 18 May 2021 23:27:42 GMT\"],\"x-ms-version\":[\"2019-02-02\"]}]" + Environment.NewLine, - logger.Logs[4].ToString()); + logger.Logs[3 + logOffSet].ToString()); } private static async Task AddSanitizerAsync(RecordingHandler testRecordingHandler, TestLogger logger) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs index 6f83380d50e..e055ef06f28 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs @@ -39,7 +39,6 @@ public async Task Start() var logBody = body == null ? "" : body.ToString(); - _logger.LogInformation($"recording: {recordingId ?? "null"}\nbody: {logBody}"); if (String.IsNullOrEmpty(file) && !String.IsNullOrEmpty(recordingId)) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitProcessHandler.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitProcessHandler.cs index fd4581b0d3c..e07ade31d2e 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitProcessHandler.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitProcessHandler.cs @@ -115,6 +115,7 @@ public virtual CommandResult Run(string arguments, string workingDirectory) } ProcessStartInfo processStartInfo = CreateGitProcessInfo(workingDirectory); + processStartInfo.Arguments = arguments; CommandResult result = new CommandResult() @@ -131,7 +132,7 @@ public virtual CommandResult Run(string arguments, string workingDirectory) int attempts = 1; while (attempts <= RETRY_INTERMITTENT_FAILURE_COUNT) { - DebugLogger.LogInformation($"git {arguments}"); + DebugLogger.LogInformation($"git {arguments} in {workingDirectory}"); var output = new List(); var error = new List(); @@ -284,7 +285,7 @@ public virtual bool TryRun(string arguments, string workingDirectory, out Comman bool continueToAttempt = true; while (continueToAttempt && attempts <= RETRY_INTERMITTENT_FAILURE_COUNT) { - DebugLogger.LogInformation($"git {arguments}"); + DebugLogger.LogInformation($"git {arguments} in {workingDirectory}"); var output = new List(); var error = new List();