From b479395bb8220f4176452802539b113f7dbc2365 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:03:07 -0700 Subject: [PATCH 1/7] Sanitize requests when logging --- .../Azure.Sdk.Tools.TestProxy.Tests.csproj | 7 ++ .../LoggingTests.cs | 115 ++++++++++++++++++ .../TestLogger.cs | 28 +++++ .../Azure.Sdk.Tools.TestProxy/Admin.cs | 18 +-- .../Common/DebugLogger.cs | 64 ++++++---- .../Azure.Sdk.Tools.TestProxy/Playback.cs | 4 +- .../Properties/AssemblyInfo.cs | 7 ++ .../Azure.Sdk.Tools.TestProxy/Record.cs | 2 +- .../RecordingHandler.cs | 27 ++-- tools/test-proxy/Directory.Build.targets | 8 ++ 10 files changed, 234 insertions(+), 46 deletions(-) create mode 100644 tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs create mode 100644 tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs create mode 100644 tools/test-proxy/Azure.Sdk.Tools.TestProxy/Properties/AssemblyInfo.cs create mode 100644 tools/test-proxy/Directory.Build.targets diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj index 9ab73a30465..9af34f989a4 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj @@ -25,6 +25,9 @@ PreserveNewest + + AzureSDKToolsKey.snk + @@ -33,4 +36,8 @@ + + + + diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs new file mode 100644 index 00000000000..b06106317d8 --- /dev/null +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs @@ -0,0 +1,115 @@ +using System.IO; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.TestProxy.Common; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging.Abstractions; +using Xunit; + +namespace Azure.Sdk.Tools.TestProxy.Tests +{ + /// + /// Logging tests cannot be run in parallel with other tests because they share a static logger. + /// + [Collection(nameof(LoggingCollection))] + public class LoggingTests + { + [Fact] + public async Task PlaybackLogsSanitizedRequest() + { + var logger = new TestLogger(); + DebugLogger.Logger = logger; + + try + { + RecordingHandler testRecordingHandler = new RecordingHandler(Directory.GetCurrentDirectory()); + var httpContext = new DefaultHttpContext(); + var body = "{\"x-recording-file\":\"Test.RecordEntries/request_with_binary_content.json\"}"; + httpContext.Request.Body = TestHelpers.GenerateStreamRequestBody(body); + httpContext.Request.ContentLength = body.Length; + + var controller = new Playback(testRecordingHandler, new NullLoggerFactory()) + { + ControllerContext = new ControllerContext() + { + HttpContext = httpContext + } + }; + await controller.Start(); + + var recordingId = httpContext.Response.Headers["x-recording-id"].ToString(); + Assert.NotNull(recordingId); + Assert.True(testRecordingHandler.PlaybackSessions.ContainsKey(recordingId)); + var entry = testRecordingHandler.PlaybackSessions[recordingId].Session.Entries[0]; + HttpRequest request = TestHelpers.CreateRequestFromEntry(entry); + request.Headers["Authorization"] = "fake-auth-header"; + + HttpResponse response = new DefaultHttpContext().Response; + await testRecordingHandler.HandlePlaybackRequest(recordingId, request, response); + + Assert.Single(logger.Logs); + var logEntry = logger.Logs[0].ToString(); + Assert.DoesNotContain(@"""Authorization"":[""fake-auth-header""]", logEntry); + Assert.Contains(@"""Authorization"":[""Sanitized""]", logEntry); + } + finally + { + DebugLogger.Logger = null; + } + } + + [Fact] + public async Task RecordingHandlerLogsSanitizedRequests() + { + var logger = new TestLogger(); + DebugLogger.Logger = logger; + var httpContext = new DefaultHttpContext(); + var bodyBytes = Encoding.UTF8.GetBytes("{\"hello\":\"world\"}"); + var mockClient = new HttpClient(new MockHttpHandler(bodyBytes, "application/json")); + var path = Directory.GetCurrentDirectory(); + var recordingHandler = new RecordingHandler(path) + { + RedirectableClient = mockClient, + RedirectlessClient = mockClient + }; + + var relativePath = "recordings/logs"; + var fullPathToRecording = Path.Combine(path, relativePath) + ".json"; + + await recordingHandler.StartRecordingAsync(relativePath, httpContext.Response); + + var recordingId = httpContext.Response.Headers["x-recording-id"].ToString(); + + httpContext.Request.ContentType = "application/json"; + httpContext.Request.Headers["Authorization"] = "fake-auth-header"; + httpContext.Request.ContentLength = 0; + httpContext.Request.Headers["x-recording-id"] = recordingId; + httpContext.Request.Headers["x-recording-upstream-base-uri"] = "http://example.org"; + httpContext.Request.Method = "GET"; + httpContext.Request.Body = new MemoryStream(CompressionUtilities.CompressBody(bodyBytes, httpContext.Request.Headers)); + + await recordingHandler.HandleRecordRequestAsync(recordingId, httpContext.Request, httpContext.Response); + recordingHandler.StopRecording(recordingId); + + try + { + Assert.Single(logger.Logs); + var logEntry = logger.Logs[0].ToString(); + Assert.DoesNotContain(@"""Authorization"":[""fake-auth-header""]", logEntry); + Assert.Contains(@"""Authorization"":[""Sanitized""]", logEntry); + } + finally + { + File.Delete(fullPathToRecording); + DebugLogger.Logger = null; + } + } + } + + [CollectionDefinition(nameof(LoggingCollection), DisableParallelization = true)] + public class LoggingCollection + { + } +} \ No newline at end of file diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs new file mode 100644 index 00000000000..f09029ec9a5 --- /dev/null +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Logging; +using ILogger = Microsoft.Extensions.Logging.ILogger; + +namespace Azure.Sdk.Tools.TestProxy.Tests +{ + public class TestLogger : ILogger + { + internal readonly List Logs = new List(); + + public IDisposable BeginScope(TState state) + { + throw new NotImplementedException(); + } + + public bool IsEnabled(LogLevel logLevel) + { + return true; + } + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, + Func formatter) + { + Logs.Add(state); + } + } +} \ No newline at end of file diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs index 0b00144138b..3c26851eaa8 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs @@ -28,25 +28,25 @@ public Admin(RecordingHandler recordingHandler, ILoggerFactory loggingFactory) } [HttpPost] - public async Task Reset() + public void Reset() { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var recordingId = RecordingHandler.GetHeader(Request, "x-recording-id", allowNulls: true); _recordingHandler.SetDefaultExtensions(recordingId); } [HttpGet] - public async Task IsAlive() + public void IsAlive() { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); Response.StatusCode = 200; } [HttpPost] public async Task AddTransform() { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var tName = RecordingHandler.GetHeader(Request, "x-abstraction-identifier"); var recordingId = RecordingHandler.GetHeader(Request, "x-recording-id", allowNulls: true); @@ -65,7 +65,7 @@ public async Task AddTransform() [HttpPost] public async Task AddSanitizer() { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var sName = RecordingHandler.GetHeader(Request, "x-abstraction-identifier"); var recordingId = RecordingHandler.GetHeader(Request, "x-recording-id", allowNulls: true); @@ -84,7 +84,7 @@ public async Task AddSanitizer() [HttpPost] public async Task SetMatcher() { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var mName = RecordingHandler.GetHeader(Request, "x-abstraction-identifier"); var recordingId = RecordingHandler.GetHeader(Request, "x-recording-id", allowNulls: true); @@ -102,9 +102,9 @@ public async Task SetMatcher() [HttpPost] [AllowEmptyBody] - public async Task SetRecordingOptions([FromBody()] IDictionary options = null) + public void SetRecordingOptions([FromBody()] IDictionary options = null) { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var recordingId = RecordingHandler.GetHeader(Request, "x-recording-id", allowNulls: true); diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs index 3ff9760b04e..8556c110f3b 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs @@ -4,11 +4,15 @@ using System.Text; using System.IO; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Text.Json; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Configuration; +using NuGet.Common; +using ILogger = Microsoft.Extensions.Logging.ILogger; +using LogLevel = Microsoft.Extensions.Logging.LogLevel; namespace Azure.Sdk.Tools.TestProxy.Common { @@ -32,13 +36,14 @@ namespace Azure.Sdk.Tools.TestProxy.Common /// public static class DebugLogger { - private static ILogger logger = null; + // internal for testing + internal static ILogger Logger { get; set; } public static void ConfigureLogger(ILoggerFactory factory) { - if (logger == null && factory != null) + if (Logger == null && factory != null) { - logger = factory.CreateLogger("DebugLogging"); + Logger = factory.CreateLogger("DebugLogging"); } } @@ -50,7 +55,7 @@ public static void ConfigureLogger(ILoggerFactory factory) /// public static bool CheckLogLevel(LogLevel level) { - var result = logger?.IsEnabled(LogLevel.Debug); + var result = Logger?.IsEnabled(LogLevel.Debug); if (result.HasValue) { @@ -68,9 +73,9 @@ public static bool CheckLogLevel(LogLevel level) /// The content which should be logged. public static void LogInformation(string details) { - if (null != logger) + if (null != Logger) { - logger.LogInformation(details); + Logger.LogInformation(details); } else { @@ -80,9 +85,9 @@ public static void LogInformation(string details) public static void LogError(string details) { - if (null != logger) + if (null != Logger) { - logger.LogError(details); + Logger.LogError(details); } else { @@ -93,9 +98,9 @@ public static void LogError(string details) public static void LogError(int statusCode, Exception e) { var details = statusCode.ToString() + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; - if (null != logger) + if (null != Logger) { - logger.LogError(details); + Logger.LogError(details); } else { @@ -109,9 +114,9 @@ public static void LogError(int statusCode, Exception e) /// The content which should be logged. public static void LogDebug(string details) { - if (logger != null) + if (Logger != null) { - logger.LogDebug(details); + Logger.LogDebug(details); } else { @@ -151,11 +156,11 @@ public static void LogDebug(string details) /// Usually will be the DI-ed individual ILogger instance from a controller. However any valid ILogger instance is fine here. /// The http request which needs to be detailed. /// - public static async Task LogRequestDetailsAsync(ILogger loggerInstance, HttpRequest req) + public static void LogRequestDetails(ILogger loggerInstance, HttpRequest req) { if(CheckLogLevel(LogLevel.Debug)) { - loggerInstance.LogDebug(await _generateLogLine(req)); + loggerInstance.LogDebug(_generateLogLine(req, null)); } } @@ -164,12 +169,13 @@ public static async Task LogRequestDetailsAsync(ILogger loggerInstance, HttpRequ /// actually logging anything, this function is entirely passthrough. /// /// The http request which needs to be detailed. - /// - public static async Task LogRequestDetailsAsync(HttpRequest req) + /// The set of sanitizers to apply before logging. + /// The log line. + public static void LogRequestDetails(HttpRequest req, IEnumerable sanitizers) { if (CheckLogLevel(LogLevel.Debug)) { - logger.LogDebug(await _generateLogLine(req)); + Logger.LogDebug(_generateLogLine(req, sanitizers)); } } @@ -177,20 +183,26 @@ public static async Task LogRequestDetailsAsync(HttpRequest req) /// Generate a line of data from an http request. This is non-destructive, which means it does not mess /// with the request Body stream at all. /// - /// - /// - private static async Task _generateLogLine(HttpRequest req) + /// The request + /// The set of sanitizers to apply before logging. + /// The log line. + private static string _generateLogLine(HttpRequest req, IEnumerable sanitizers) { - StringBuilder sb = new StringBuilder(); - string headers = string.Empty; + RecordEntry entry = RecordingHandler.CreateNoBodyRecordEntry(req); - using (MemoryStream ms = new MemoryStream()) + if (sanitizers != null) { - await JsonSerializer.SerializeAsync(ms, req.Headers); - headers = Encoding.UTF8.GetString(ms.ToArray()); + foreach (var sanitizer in sanitizers) + { + sanitizer.Sanitize(entry); + } } - sb.AppendLine("URI: [ " + req.GetDisplayUrl() + "]"); + var headers = Encoding.UTF8.GetString(JsonSerializer.SerializeToUtf8Bytes(entry.Request.Headers)); + + StringBuilder sb = new StringBuilder(); + + sb.AppendLine("URI: [ " + entry.RequestUri + "]"); sb.AppendLine("Headers: [" + headers + "]"); return sb.ToString(); diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs index c7d82c44d8b..44b62c38f31 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs @@ -63,7 +63,7 @@ public void Stop() [HttpPost] public async Task Reset([FromBody()] IDictionary options = null) { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var pathToAssets = RecordingHandler.GetAssetsJsonLocation(StoreResolver.ParseAssetsJsonBody(options), _recordingHandler.ContextDirectory); @@ -73,7 +73,7 @@ public async Task Reset([FromBody()] IDictionary options = null) [HttpPost] public async Task Restore([FromBody()] IDictionary options = null) { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var pathToAssets = RecordingHandler.GetAssetsJsonLocation(StoreResolver.ParseAssetsJsonBody(options), _recordingHandler.ContextDirectory); diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Properties/AssemblyInfo.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..7ad94ee8711 --- /dev/null +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.Sdk.Tools.TestProxy.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100259ae92701e6c1d912e6126950be871a0aa0bc76c69b573a8f549708e4f5b9658246d97f239964447af47052f09df117f955af39c1bfc43c369ada5460750e7dd0b0f178a70bb970a8fb74f9d892636a4ac38234157de5482482d3debd80f082d6b55a5761cc97c261e5ad3ba3025c06990011f1f86cc021de48381c8174049a")] + diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs index fb12f08d5c1..d63be791388 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs @@ -56,7 +56,7 @@ public async Task Start() [HttpPost] public async Task Push([FromBody()] IDictionary options = null) { - await DebugLogger.LogRequestDetailsAsync(_logger, Request); + DebugLogger.LogRequestDetails(_logger, Request); var pathToAssets = RecordingHandler.GetAssetsJsonLocation(StoreResolver.ParseAssetsJsonBody(options), _recordingHandler.ContextDirectory); diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs index af8a23ca1c2..ad6379385c2 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs @@ -187,13 +187,15 @@ public async Task StartRecordingAsync(string sessionId, HttpResponse outgoingRes public async Task HandleRecordRequestAsync(string recordingId, HttpRequest incomingRequest, HttpResponse outgoingResponse) { - await DebugLogger.LogRequestDetailsAsync(incomingRequest); - if (!RecordingSessions.TryGetValue(recordingId, out var session)) { throw new HttpException(HttpStatusCode.BadRequest, $"There is no active recording session under id {recordingId}."); } + var sanitizers = session.AdditionalSanitizers.Count > 0 ? Sanitizers.Concat(session.AdditionalSanitizers) : Sanitizers; + + DebugLogger.LogRequestDetails(incomingRequest, sanitizers); + (RecordEntry entry, byte[] requestBody) = await CreateEntryAsync(incomingRequest).ConfigureAwait(false); var upstreamRequest = CreateUpstreamRequest(incomingRequest, requestBody); @@ -428,13 +430,15 @@ public void StopPlayback(string recordingId, bool purgeMemoryStore = false) public async Task HandlePlaybackRequest(string recordingId, HttpRequest incomingRequest, HttpResponse outgoingResponse) { - await DebugLogger.LogRequestDetailsAsync(incomingRequest); - if (!PlaybackSessions.TryGetValue(recordingId, out var session)) { throw new HttpException(HttpStatusCode.BadRequest, $"There is no active playback session under recording id {recordingId}."); } + var sanitizers = session.AdditionalSanitizers.Count > 0 ? Sanitizers.Concat(session.AdditionalSanitizers) : Sanitizers; + + DebugLogger.LogRequestDetails(incomingRequest, sanitizers); + var entry = (await CreateEntryAsync(incomingRequest).ConfigureAwait(false)).Item1; // If request contains "x-recording-remove: false", then request is not removed from session after playback. @@ -531,6 +535,16 @@ public async Task WriteBodyBytes(byte[] bodyData, int playbackResponseTime, Http } public static async Task<(RecordEntry, byte[])> CreateEntryAsync(HttpRequest request) + { + var entry = CreateNoBodyRecordEntry(request); + + byte[] bytes = await ReadAllBytes(request.Body).ConfigureAwait(false); + entry.Request.Body = CompressionUtilities.DecompressBody(bytes, request.Headers); + + return (entry, bytes); + } + + public static RecordEntry CreateNoBodyRecordEntry(HttpRequest request) { var entry = new RecordEntry(); entry.RequestUri = GetRequestUri(request).AbsoluteUri; @@ -544,10 +558,7 @@ public async Task WriteBodyBytes(byte[] bodyData, int playbackResponseTime, Http } } - byte[] bytes = await ReadAllBytes(request.Body).ConfigureAwait(false); - - entry.Request.Body = CompressionUtilities.DecompressBody(bytes, request.Headers); - return (entry, bytes); + return entry; } #endregion diff --git a/tools/test-proxy/Directory.Build.targets b/tools/test-proxy/Directory.Build.targets new file mode 100644 index 00000000000..8186f05afe4 --- /dev/null +++ b/tools/test-proxy/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + true + false + $(RepoEngPath)\AzureSDKToolsKey.snk + + \ No newline at end of file From a6582e5858d8b10f69b16b34d7985eadd9a99a74 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:05:16 -0700 Subject: [PATCH 2/7] remove unneeded changes --- .../Azure.Sdk.Tools.TestProxy.Tests.csproj | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj index 9af34f989a4..9ab73a30465 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj @@ -25,9 +25,6 @@ PreserveNewest - - AzureSDKToolsKey.snk - @@ -36,8 +33,4 @@ - - - - From 5429d16777b8b99422436efbe1036d93bb3dbf3e Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:07:15 -0700 Subject: [PATCH 3/7] erroneous usings --- .../test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs index 8556c110f3b..52dd7334292 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs @@ -10,9 +10,6 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Configuration; -using NuGet.Common; -using ILogger = Microsoft.Extensions.Logging.ILogger; -using LogLevel = Microsoft.Extensions.Logging.LogLevel; namespace Azure.Sdk.Tools.TestProxy.Common { From 00b46b7a731626a0adc1f41039ac1d687fb52236 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:10:49 -0700 Subject: [PATCH 4/7] more cleanup --- tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs index f09029ec9a5..60116223ca6 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestLogger.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; using Microsoft.Extensions.Logging; -using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Azure.Sdk.Tools.TestProxy.Tests { public class TestLogger : ILogger { - internal readonly List Logs = new List(); + internal List Logs { get; }= new List(); public IDisposable BeginScope(TState state) { From 9bf790cc79c8da320d4dd5834fb47e9343bbe927 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:32:59 -0700 Subject: [PATCH 5/7] Fix props --- .../{Directory.Build.targets => Directory.Build.props} | 1 + 1 file changed, 1 insertion(+) rename tools/test-proxy/{Directory.Build.targets => Directory.Build.props} (73%) diff --git a/tools/test-proxy/Directory.Build.targets b/tools/test-proxy/Directory.Build.props similarity index 73% rename from tools/test-proxy/Directory.Build.targets rename to tools/test-proxy/Directory.Build.props index 8186f05afe4..c0a4bb0bbad 100644 --- a/tools/test-proxy/Directory.Build.targets +++ b/tools/test-proxy/Directory.Build.props @@ -1,4 +1,5 @@  + true From ef9c3f2020dfaa2ade48fc962ef3f540b33439c7 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:41:51 -0700 Subject: [PATCH 6/7] move targets to test directory --- .../Azure.Sdk.Tools.TestProxy.Tests.csproj | 1 + .../Directory.Build.targets} | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename tools/test-proxy/{Directory.Build.props => Azure.Sdk.Tools.TestProxy.Tests/Directory.Build.targets} (84%) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj index 9ab73a30465..bf29459fd63 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj @@ -4,6 +4,7 @@ net6.0 false false + true diff --git a/tools/test-proxy/Directory.Build.props b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Directory.Build.targets similarity index 84% rename from tools/test-proxy/Directory.Build.props rename to tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Directory.Build.targets index c0a4bb0bbad..e76b95e4b90 100644 --- a/tools/test-proxy/Directory.Build.props +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Directory.Build.targets @@ -1,5 +1,5 @@  - + true From 0283714f51a661a45a1b56ed30733ac61c897b75 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:42:25 -0700 Subject: [PATCH 7/7] remove prop --- .../Azure.Sdk.Tools.TestProxy.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj index bf29459fd63..9ab73a30465 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj @@ -4,7 +4,6 @@ net6.0 false false - true