Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/common/post-build/nuget-verification.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
[CmdletBinding(PositionalBinding = $false)]
param(
[string]$NuGetExePath,
[string]$PackageSource = "https://api.nuget.org/v3/index.json",
[string]$PackageSource = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json",
[string]$DownloadPath,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ public IntegrationTestBase()
{
_testEnvironment = new IntegrationTestEnvironment();
BuildConfiguration = IntegrationTestEnvironment.BuildConfiguration;

TempDirectory.NuGetConfigPath = Path.Combine(IntegrationTestEnvironment.RepoRootDirectory, "NuGet.config");
TempDirectory = new TempDirectory();


var drive = new DriveInfo(Directory.GetDirectoryRoot(TempDirectory.Path));
Console.WriteLine($"Available space for TEMP: {drive.Name} {drive.AvailableFreeSpace / (1024 * 1024)} MB");

Expand Down
16 changes: 16 additions & 0 deletions test/Microsoft.TestPlatform.TestUtilities/TempDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;

using IO = System.IO;

Expand All @@ -23,6 +24,8 @@ public TempDirectory()

public string Path { get; }

public static string? NuGetConfigPath { get; set; }

public void Dispose()
{
Dispose(true);
Expand Down Expand Up @@ -91,12 +94,25 @@ public string CopyFile(string filePath)
/// <returns>
/// Path of the created directory.
/// </returns>
[MethodImpl(MethodImplOptions.Synchronized)]
internal static string CreateUniqueDirectory()
{
var temp = GetTempPath();
var directoryPath = IO.Path.Combine(temp, "vstest", RandomId.Next());
Directory.CreateDirectory(directoryPath);

if (NuGetConfigPath == null)
{
throw new InvalidOperationException("NuGetConfigPath on TempDirectory class must be set.");
}

var tempNugetConfigPath = IO.Path.Combine(directoryPath, IO.Path.GetFileName(NuGetConfigPath));

if (!File.Exists(tempNugetConfigPath))
{
File.Copy(NuGetConfigPath, tempNugetConfigPath);
}

return directoryPath;
}

Expand Down
Loading