Skip to content

Commit

Permalink
repair tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Sep 12, 2023
1 parent 550a0c5 commit d6311c0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ public async Task BreadCrumbMaintainsMultipleBreadCrumbs()

try
{
var assetStore = (await _defaultStore.ParseConfigurationFile(Path.Join(testFolder, target1))).ResolveAssetsStoreLocation();
var parsedConfiguration = await _defaultStore.ParseConfigurationFile(Path.Join(testFolder, target1));
var assetStore = parsedConfiguration.ResolveAssetsStoreLocation(parsedConfiguration.RepoRoot);

var breadCrumbs = new List<string>();

Expand Down
10 changes: 5 additions & 5 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,25 @@ public async Task RecordingHandlerLogsSanitizedRequests()

private static void AssertLogs(TestLogger logger)
{
Assert.Equal(4, logger.Logs.Count);
Assert.Equal(5, 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[0].ToString());
logger.Logs[1].ToString());
Assert.Equal(
"Request Body Content{\"key\":\"Location\",\"value\":\"https://fakeazsdktestaccount.table.core.windows.net/Tables\"}",
logger.Logs[1].ToString());
logger.Logs[2].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[2].ToString());
logger.Logs[3].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[3].ToString());
logger.Logs[4].ToString());
}

private static async Task AddSanitizerAsync(RecordingHandler testRecordingHandler, TestLogger logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public static void CreateFileWithInitialVersion(string testFolder, string fileNa
/// <param name="configuration"></param>
public static void CheckBreadcrumbAgainstAssetsConfig(GitAssetsConfiguration configuration)
{
var assetsStorePath = configuration.ResolveAssetsStoreLocation();
var assetsStorePath = configuration.ResolveAssetsStoreLocation(configuration.RepoRoot);
var breadCrumbFile = Path.Join(assetsStorePath.ToString(), "breadcrumb", $"{configuration.AssetRepoShortHash}.breadcrumb");
var targetKey = configuration.AssetsJsonRelativeLocation.ToString();

Expand Down
5 changes: 4 additions & 1 deletion tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public async Task Start()
HttpRequestInteractions.GetBodyKey(body, "x-recording-assets-file", allowNulls: true),
_recordingHandler.ContextDirectory);

_logger.LogInformation($"recording: {recordingId ?? "null"}\nbody: {body.ToString()}");

var logBody = body == null ? "" : body.ToString();

_logger.LogInformation($"recording: {recordingId ?? "null"}\nbody: {logBody}");

if (String.IsNullOrEmpty(file) && !String.IsNullOrEmpty(recordingId))
{
Expand Down

0 comments on commit d6311c0

Please sign in to comment.