Skip to content

Commit

Permalink
Fix test failuies
Browse files Browse the repository at this point in the history
  • Loading branch information
ralph-msft committed Apr 4, 2024
1 parent 420a5d6 commit 26250eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/common/details/helpers/process_helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using Azure.AI.CLI.Common.Clients.Models;
using Newtonsoft.Json.Linq;

namespace Azure.AI.Details.Common.CLI
{
Expand All @@ -21,7 +19,10 @@ public readonly struct ProcessOutput
public string MergedOutput { get; init; }
public int ExitCode { get; init; }

public bool HasError => ExitCode != 0 || !string.IsNullOrWhiteSpace(StdError);
public bool HasError => ExitCode != 0
|| (!string.IsNullOrWhiteSpace(StdError)
// Special case to ignore errors when tests are running against the test-proxy
&& !(StdError.Contains("`subjectAltName`") && StdError.Contains("`commonName`")));
}

public class ProcessHelpers
Expand Down
12 changes: 11 additions & 1 deletion src/testing/adapters/recordingadapter/TestProxyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,17 @@ private static async Task AddSanitizer(string headerName, JsonObject json)
var result = await _httpClient.SendAsync(message);
if (result.StatusCode != HttpStatusCode.OK)
{
throw new Exception($"Failed to add sanitizer {result.StatusCode} {result.Content}");
string responseContent = string.Empty;
if (result.Content != null)
{
try
{
responseContent = await result.Content.ReadAsStringAsync();
}
catch { }
}

throw new Exception($"Failed to add sanitizer {result.StatusCode} {responseContent}");
}
}

Expand Down

0 comments on commit 26250eb

Please sign in to comment.