diff --git a/build/RunTestsOnHelix.cmd b/build/RunTestsOnHelix.cmd index da99dfc84d1e..92a5da27c932 100644 --- a/build/RunTestsOnHelix.cmd +++ b/build/RunTestsOnHelix.cmd @@ -18,3 +18,8 @@ set TestExecutionDirectory=%TEMP%\dotnetSdkTests\%RandomDirectoryName% set DOTNET_CLI_HOME=%TestExecutionDirectory%\.dotnet mkdir %TestExecutionDirectory% robocopy %HELIX_CORRELATION_PAYLOAD%\t\TestExecutionDirectoryFiles %TestExecutionDirectory% + +REM call dotnet new so the first run message doesn't interfere with the first test +dotnet new +REM avoid potetial cocurrency issues when nuget is creating nuget.config +dotnet nuget list source \ No newline at end of file diff --git a/build/RunTestsOnHelix.sh b/build/RunTestsOnHelix.sh index 088c5c6365f3..389c3d95fcba 100644 --- a/build/RunTestsOnHelix.sh +++ b/build/RunTestsOnHelix.sh @@ -8,3 +8,8 @@ export TestExecutionDirectory=$(pwd)/testExecutionDirectory mkdir $TestExecutionDirectory export DOTNET_CLI_HOME=$TestExecutionDirectory/.dotnet cp -a $HELIX_CORRELATION_PAYLOAD/t/TestExecutionDirectoryFiles/. $TestExecutionDirectory/ + +# call dotnet new so the first run message doesn't interfere with the first test +dotnet new +# avoid potetial concurrency issues when nuget is creating nuget.config +dotnet nuget list source diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkManagedInstaller.cs b/src/Cli/dotnet/commands/dotnet-workload/install/FileBasedInstaller.cs similarity index 98% rename from src/Cli/dotnet/commands/dotnet-workload/install/NetSdkManagedInstaller.cs rename to src/Cli/dotnet/commands/dotnet-workload/install/FileBasedInstaller.cs index 30dd78018ee4..b002aa6373d1 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkManagedInstaller.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/FileBasedInstaller.cs @@ -20,7 +20,7 @@ namespace Microsoft.DotNet.Workloads.Workload.Install { - internal class NetSdkManagedInstaller : IWorkloadPackInstaller + internal class FileBasedInstaller : IWorkloadPackInstaller { private readonly IReporter _reporter; private readonly string _workloadMetadataDir; @@ -31,13 +31,13 @@ internal class NetSdkManagedInstaller : IWorkloadPackInstaller private readonly INuGetPackageDownloader _nugetPackageDownloader; private readonly IWorkloadResolver _workloadResolver; private readonly SdkFeatureBand _sdkFeatureBand; - private readonly NetSdkManagedInstallationRecordRepository _installationRecordRepository; + private readonly FileBasedInstallationRecordRepository _installationRecordRepository; private readonly PackageSourceLocation _packageSourceLocation; private readonly RestoreActionConfig _restoreActionConfig; public int ExitCode => 0; - public NetSdkManagedInstaller(IReporter reporter, + public FileBasedInstaller(IReporter reporter, SdkFeatureBand sdkFeatureBand, IWorkloadResolver workloadResolver, string userProfileDir, @@ -62,7 +62,7 @@ public NetSdkManagedInstaller(IReporter reporter, _reporter = reporter; _sdkFeatureBand = sdkFeatureBand; _workloadResolver = workloadResolver; - _installationRecordRepository = new NetSdkManagedInstallationRecordRepository(_workloadMetadataDir); + _installationRecordRepository = new FileBasedInstallationRecordRepository(_workloadMetadataDir); _packageSourceLocation = packageSourceLocation; } @@ -78,7 +78,7 @@ public IWorkloadPackInstaller GetPackInstaller() public IWorkloadInstaller GetWorkloadInstaller() { - throw new Exception("NetSdkManagedInstaller is not a workload installer."); + throw new Exception($"{nameof(FileBasedInstaller)} is not a workload installer."); } public IWorkloadInstallationRecordRepository GetWorkloadInstallationRecordRepository() diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/NetSdkManagedInstallationRecordInstaller.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/FileBasedInstallationRecordInstaller.cs similarity index 93% rename from src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/NetSdkManagedInstallationRecordInstaller.cs rename to src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/FileBasedInstallationRecordInstaller.cs index 518bf698affe..9957b8d6c6aa 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/NetSdkManagedInstallationRecordInstaller.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/FileBasedInstallationRecordInstaller.cs @@ -9,12 +9,12 @@ namespace Microsoft.DotNet.Workloads.Workload.Install.InstallRecord { - internal class NetSdkManagedInstallationRecordRepository : IWorkloadInstallationRecordRepository + internal class FileBasedInstallationRecordRepository : IWorkloadInstallationRecordRepository { private readonly string _workloadMetadataDir; private const string InstalledWorkloadDir = "InstalledWorkloads"; - public NetSdkManagedInstallationRecordRepository(string workloadMetadataDir) + public FileBasedInstallationRecordRepository(string workloadMetadataDir) { _workloadMetadataDir = workloadMetadataDir; } diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallerFactory.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallerFactory.cs index 0f124395d287..3124b07a48b1 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallerFactory.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallerFactory.cs @@ -48,7 +48,7 @@ public static IInstaller GetWorkloadInstaller( userProfileDir ??= CliFolderPathCalculator.DotnetUserProfileFolderPath; - return new NetSdkManagedInstaller(reporter, + return new FileBasedInstaller(reporter, sdkFeatureBand, workloadResolver, userProfileDir, diff --git a/src/Tests/dotnet-workload-install.Tests/GivenNetSdkManagedWorkloadInstall.cs b/src/Tests/dotnet-workload-install.Tests/GivenFileBasedWorkloadInstall.cs similarity index 97% rename from src/Tests/dotnet-workload-install.Tests/GivenNetSdkManagedWorkloadInstall.cs rename to src/Tests/dotnet-workload-install.Tests/GivenFileBasedWorkloadInstall.cs index 47ea78cba3c8..9681d6580776 100644 --- a/src/Tests/dotnet-workload-install.Tests/GivenNetSdkManagedWorkloadInstall.cs +++ b/src/Tests/dotnet-workload-install.Tests/GivenFileBasedWorkloadInstall.cs @@ -23,12 +23,12 @@ namespace Microsoft.DotNet.Cli.Workload.Install.Tests { - public class GivenNetSdkManagedWorkloadInstall : SdkTest + public class GivenFileBasedWorkloadInstall : SdkTest { private readonly BufferedReporter _reporter; private readonly string _manifestPath; - public GivenNetSdkManagedWorkloadInstall(ITestOutputHelper log) : base(log) + public GivenFileBasedWorkloadInstall(ITestOutputHelper log) : base(log) { _reporter = new BufferedReporter(); _manifestPath = Path.Combine(_testAssetsManager.GetAndValidateTestProjectDirectory("SampleManifest"), "Sample.json"); @@ -428,7 +428,7 @@ public void GivenManagedInstallItCanErrorsWhenMissingOfflineCache() exceptionThrown.Message.Should().Contain(cachePath); } - private (string, NetSdkManagedInstaller, INuGetPackageDownloader) GetTestInstaller([CallerMemberName] string testName = "", bool failingInstaller = false, string identifier = "", bool manifestDownload = false, + private (string, FileBasedInstaller, INuGetPackageDownloader) GetTestInstaller([CallerMemberName] string testName = "", bool failingInstaller = false, string identifier = "", bool manifestDownload = false, PackageSourceLocation packageSourceLocation = null) { var testDirectory = _testAssetsManager.CreateTestDirectory(testName, identifier: identifier).Path; @@ -436,7 +436,7 @@ public void GivenManagedInstallItCanErrorsWhenMissingOfflineCache() INuGetPackageDownloader nugetInstaller = failingInstaller ? new FailingNuGetPackageDownloader(testDirectory) : new MockNuGetPackageDownloader(dotnetRoot, manifestDownload); var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { _manifestPath }), dotnetRoot); var sdkFeatureBand = new SdkFeatureBand("6.0.100"); - return (dotnetRoot, new NetSdkManagedInstaller(_reporter, sdkFeatureBand, workloadResolver, userProfileDir: testDirectory, nugetInstaller, dotnetRoot, packageSourceLocation: packageSourceLocation), nugetInstaller); + return (dotnetRoot, new FileBasedInstaller(_reporter, sdkFeatureBand, workloadResolver, userProfileDir: testDirectory, nugetInstaller, dotnetRoot, packageSourceLocation: packageSourceLocation), nugetInstaller); } } }