Skip to content

Commit

Permalink
Condition out internal auth for SDK content test
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussell committed Oct 25, 2024
1 parent a3e5ff1 commit df07a42
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/Microsoft.DotNet.Docker.Tests/SdkImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,21 @@ private static IEnumerable<SdkContentFileInfo> EnumerateArchiveContents(string p
private async Task<IEnumerable<SdkContentFileInfo>> GetExpectedSdkContentsAsync(ProductImageData imageData)
{
string sdkUrl = GetSdkUrl(imageData);
OutputHelper.WriteLine("Downloading SDK archive: " + sdkUrl);

if (!s_sdkContentsCache.TryGetValue(sdkUrl, out IEnumerable<SdkContentFileInfo> files))
{
string sdkFile = Path.GetTempFileName();

using HttpClient httpClient = new();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "",
Config.InternalAccessToken))));

if (Config.IsInternal)
{
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "",
Config.InternalAccessToken))));
}

await httpClient.DownloadFileAsync(new Uri(sdkUrl), sdkFile);

Expand Down

0 comments on commit df07a42

Please sign in to comment.