From 089f3ffda410d0cccf911b4b1d656bf8d6a4eff4 Mon Sep 17 00:00:00 2001 From: Grace Kulin Date: Tue, 15 Feb 2022 12:12:23 -0800 Subject: [PATCH 1/3] Rename "NetSdkManaged" types to "FileBased" Fixes #23758 --- ...NetSdkManagedInstaller.cs => FileBasedInstaller.cs} | 10 +++++----- ...ller.cs => FileBasedInstallationRecordInstaller.cs} | 4 ++-- .../install/WorkloadInstallerFactory.cs | 2 +- ...loadInstall.cs => GivenFileBasedWorkloadInstall.cs} | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) rename src/Cli/dotnet/commands/dotnet-workload/install/{NetSdkManagedInstaller.cs => FileBasedInstaller.cs} (98%) rename src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallRecords/{NetSdkManagedInstallationRecordInstaller.cs => FileBasedInstallationRecordInstaller.cs} (93%) rename src/Tests/dotnet-workload-install.Tests/{GivenNetSdkManagedWorkloadInstall.cs => GivenFileBasedWorkloadInstall.cs} (97%) 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); } } } From 89fe5657624e6a5c993a6ccf25931f667779e527 Mon Sep 17 00:00:00 2001 From: Grace Kulin Date: Thu, 17 Feb 2022 11:52:14 -0800 Subject: [PATCH 2/3] fix helix testing issues (nuget list) --- build/RunTestsOnHelix.cmd | 5 +++++ build/RunTestsOnHelix.sh | 5 +++++ 2 files changed, 10 insertions(+) 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..4757aeba3a73 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 cocurrency issues when nuget is creating nuget.config +dotnet nuget list source \ No newline at end of file From f2c3ea6be6efe93c5bba2904c1c820f8d3831d2b Mon Sep 17 00:00:00 2001 From: Grace Kulin <55554236+gkulin@users.noreply.github.com> Date: Thu, 17 Feb 2022 14:53:28 -0800 Subject: [PATCH 3/3] Fix typo in RunTestsOnHelix.sh --- build/RunTestsOnHelix.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/RunTestsOnHelix.sh b/build/RunTestsOnHelix.sh index 4757aeba3a73..389c3d95fcba 100644 --- a/build/RunTestsOnHelix.sh +++ b/build/RunTestsOnHelix.sh @@ -11,5 +11,5 @@ cp -a $HELIX_CORRELATION_PAYLOAD/t/TestExecutionDirectoryFiles/. $TestExecutionD # call dotnet new so the first run message doesn't interfere with the first test dotnet new -# avoid potetial cocurrency issues when nuget is creating nuget.config -dotnet nuget list source \ No newline at end of file +# avoid potetial concurrency issues when nuget is creating nuget.config +dotnet nuget list source