From 37d1f697a1e9ce9e2cf6391cd10a177484aaef96 Mon Sep 17 00:00:00 2001 From: Andy Staples Date: Thu, 11 Jul 2024 15:52:06 -0600 Subject: [PATCH 1/7] Shut off MD module upgrades after 7.4 EOL --- .../BackgroundDependencySnapshotMaintainer.cs | 13 ++++ src/DependencyManagement/DependencyManager.cs | 13 ++++ src/DependencyManagement/WorkerEnvironment.cs | 7 +++ src/resources/PowerShellWorkerStrings.resx | 9 ++- .../DependencyManagerTests.cs | 61 +++++++++++-------- 5 files changed, 74 insertions(+), 29 deletions(-) diff --git a/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs b/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs index deba2e90..b42faacd 100644 --- a/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs +++ b/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs @@ -20,6 +20,9 @@ internal class BackgroundDependencySnapshotMaintainer : IBackgroundDependencySna private TimeSpan MaxBackgroundUpgradePeriod { get; } = PowerShellWorkerConfiguration.GetTimeSpan("MDMaxBackgroundUpgradePeriod") ?? TimeSpan.FromDays(7); + private bool EnableAutomaticUpgrades { get; } = + PowerShellWorkerConfiguration.GetBoolean("MDEnableAutomaticUpgrades") ?? false; + private readonly IDependencyManagerStorage _storage; private readonly IDependencySnapshotInstaller _installer; private readonly IDependencySnapshotPurger _purger; @@ -42,6 +45,16 @@ public void Start(string currentSnapshotPath, DependencyManifestEntry[] dependen _purger.SetCurrentlyUsedSnapshot(currentSnapshotPath, logger); + if (!EnableAutomaticUpgrades) + { + logger.Log( + isUserOnlyLog: false, + RpcLog.Types.Level.Warning, + PowerShellWorkerStrings.AutomaticUpgradesAreDisabled); + + return; + } + _installAndPurgeTimer = new Timer( _ => InstallAndPurgeSnapshots(PowerShell.Create, logger), state: null, diff --git a/src/DependencyManagement/DependencyManager.cs b/src/DependencyManagement/DependencyManager.cs index 71caf2bd..682fb914 100644 --- a/src/DependencyManagement/DependencyManager.cs +++ b/src/DependencyManagement/DependencyManager.cs @@ -41,6 +41,9 @@ internal class DependencyManager : IDisposable private Task _dependencyInstallationTask; + private bool EnableAutomaticUpgrades { get; } = + PowerShellWorkerConfiguration.GetBoolean("MDEnableAutomaticUpgrades") ?? false; + #endregion public DependencyManager( @@ -204,6 +207,16 @@ internal Exception InstallFunctionAppDependencies(PowerShell firstPwsh, Func PowerShellSDKDeprecationDate; + } } } diff --git a/src/resources/PowerShellWorkerStrings.resx b/src/resources/PowerShellWorkerStrings.resx index 53f0c801..d801396c 100644 --- a/src/resources/PowerShellWorkerStrings.resx +++ b/src/resources/PowerShellWorkerStrings.resx @@ -352,6 +352,9 @@ Dependency snapshot '{0}' does not contain acceptable module versions. + + Worker init request completed in {0} ms. + Found external Durable Functions SDK in session: Name='{0}', Version='{1}', Path='{2}'. @@ -361,9 +364,6 @@ Unable to initialize orchestrator function due to presence of other bindings. Total number of bindings found is '{0}'. Orchestrator Functions should never use any input or output bindings other than the orchestration trigger itself. See: aka.ms/df-bindings - - Worker init request completed in {0} ms. - Operation '{0}' expected '{1}' result(s) but received '{2}'. @@ -388,4 +388,7 @@ The app is configured to use OpenTelemetry but the TraceContext passed from host was null. + + Automatic upgrades are disabled in PowerShell 7.4 function apps. This warning should not be emitted until PowerShell 7.4's End of Life date, at which time, more guidance will be available regarding how to upgrade your function app to the latest version. + \ No newline at end of file diff --git a/test/Unit/DependencyManagement/DependencyManagerTests.cs b/test/Unit/DependencyManagement/DependencyManagerTests.cs index fbe8a13c..ec53d3dd 100644 --- a/test/Unit/DependencyManagement/DependencyManagerTests.cs +++ b/test/Unit/DependencyManagement/DependencyManagerTests.cs @@ -229,40 +229,49 @@ public void StartDependencyInstallationIfNeeded_InstallsSnapshotInForeground_Whe [Fact] public void StartDependencyInstallationIfNeeded_InvokesBackgroundMaintainer_WhenAcceptableDependenciesAlreadyInstalled() { - _mockInstalledDependenciesLocator.Setup(_ => _.GetPathWithAcceptableDependencyVersionsInstalled()) - .Returns("AlreadyInstalled"); - _mockStorage.Setup(_ => _.GetDependencies()).Returns(GetAnyNonEmptyDependencyManifestEntries()); + try + { + Environment.SetEnvironmentVariable("MDEnableAutomaticUpgrades", "true"); - var firstPowerShellRunspace = PowerShell.Create(); - Func powerShellFactory = PowerShell.Create; + _mockInstalledDependenciesLocator.Setup(_ => _.GetPathWithAcceptableDependencyVersionsInstalled()) + .Returns("AlreadyInstalled"); + _mockStorage.Setup(_ => _.GetDependencies()).Returns(GetAnyNonEmptyDependencyManifestEntries()); - _mockStorage.Setup(_ => _.SnapshotExists("AlreadyInstalled")).Returns(true); + var firstPowerShellRunspace = PowerShell.Create(); + Func powerShellFactory = PowerShell.Create; - _mockBackgroundDependencySnapshotMaintainer.Setup( - _ => _.InstallAndPurgeSnapshots(It.IsAny>(), It.IsAny())) - .Returns("NewSnapshot"); + _mockStorage.Setup(_ => _.SnapshotExists("AlreadyInstalled")).Returns(true); - using (var dependencyManager = CreateDependencyManagerWithMocks()) - { - dependencyManager.Initialize(_mockLogger.Object); - dependencyManager.StartDependencyInstallationIfNeeded(firstPowerShellRunspace, powerShellFactory, _mockLogger.Object); - var hadToWait = dependencyManager.WaitForDependenciesAvailability(() => _mockLogger.Object); + _mockBackgroundDependencySnapshotMaintainer.Setup( + _ => _.InstallAndPurgeSnapshots(It.IsAny>(), It.IsAny())) + .Returns("NewSnapshot"); - Assert.False(hadToWait); - Assert.Equal("NewSnapshot", dependencyManager.WaitForBackgroundDependencyInstallationTaskCompletion()); + using (var dependencyManager = CreateDependencyManagerWithMocks()) + { + dependencyManager.Initialize(_mockLogger.Object); + dependencyManager.StartDependencyInstallationIfNeeded(firstPowerShellRunspace, powerShellFactory, _mockLogger.Object); + var hadToWait = dependencyManager.WaitForDependenciesAvailability(() => _mockLogger.Object); - _mockBackgroundDependencySnapshotMaintainer.Verify( - _ => _.InstallAndPurgeSnapshots(powerShellFactory, _mockLogger.Object), + Assert.False(hadToWait); + Assert.Equal("NewSnapshot", dependencyManager.WaitForBackgroundDependencyInstallationTaskCompletion()); + + _mockBackgroundDependencySnapshotMaintainer.Verify( + _ => _.InstallAndPurgeSnapshots(powerShellFactory, _mockLogger.Object), + Times.Once); + } + + _mockLogger.Verify( + _ => _.Log( + false, + LogLevel.Trace, + It.Is(message => message.Contains(PowerShellWorkerStrings.AcceptableFunctionAppDependenciesAlreadyInstalled)), + It.IsAny()), Times.Once); } - - _mockLogger.Verify( - _ => _.Log( - false, - LogLevel.Trace, - It.Is(message => message.Contains(PowerShellWorkerStrings.AcceptableFunctionAppDependenciesAlreadyInstalled)), - It.IsAny()), - Times.Once); + finally + { + Environment.SetEnvironmentVariable("MDEnableAutomaticUpgrades", null); + } } [Fact] From a5c7cd87c5670bcdbd04de57193cb2d6b8d524f5 Mon Sep 17 00:00:00 2001 From: Andy Staples Date: Thu, 11 Jul 2024 15:56:28 -0600 Subject: [PATCH 2/7] Missed edit to one file checking date --- .../BackgroundDependencySnapshotMaintainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs b/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs index b42faacd..92960ce3 100644 --- a/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs +++ b/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs @@ -23,6 +23,7 @@ internal class BackgroundDependencySnapshotMaintainer : IBackgroundDependencySna private bool EnableAutomaticUpgrades { get; } = PowerShellWorkerConfiguration.GetBoolean("MDEnableAutomaticUpgrades") ?? false; + private readonly IDependencyManagerStorage _storage; private readonly IDependencySnapshotInstaller _installer; private readonly IDependencySnapshotPurger _purger; @@ -45,7 +46,7 @@ public void Start(string currentSnapshotPath, DependencyManifestEntry[] dependen _purger.SetCurrentlyUsedSnapshot(currentSnapshotPath, logger); - if (!EnableAutomaticUpgrades) + if (WorkerEnvironment.IsPowerShellSDKDeprecated() && !EnableAutomaticUpgrades) { logger.Log( isUserOnlyLog: false, From fe18a7af5dbdce3cf1a7d35690b577db4b4bd8c9 Mon Sep 17 00:00:00 2001 From: Andy Staples Date: Wed, 7 Aug 2024 15:10:40 -0600 Subject: [PATCH 3/7] Address PR concerns - Move ShouldEnableManagedDpendencyUpgrades logic to dedicated function - Move check to InstallAndPurgeSnapshots for long-running workers - Adjust tests to mock ShouldEnableManagedDpendencyUpgrades correctly --- .../BackgroundDependencySnapshotMaintainer.cs | 36 +++++++------ src/DependencyManagement/DependencyManager.cs | 17 ++++++- ...groundDependencySnapshotMaintainerTests.cs | 50 ++++++++++++++++--- 3 files changed, 80 insertions(+), 23 deletions(-) diff --git a/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs b/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs index 92960ce3..642ac624 100644 --- a/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs +++ b/src/DependencyManagement/BackgroundDependencySnapshotMaintainer.cs @@ -20,9 +20,7 @@ internal class BackgroundDependencySnapshotMaintainer : IBackgroundDependencySna private TimeSpan MaxBackgroundUpgradePeriod { get; } = PowerShellWorkerConfiguration.GetTimeSpan("MDMaxBackgroundUpgradePeriod") ?? TimeSpan.FromDays(7); - private bool EnableAutomaticUpgrades { get; } = - PowerShellWorkerConfiguration.GetBoolean("MDEnableAutomaticUpgrades") ?? false; - + private Func _getShouldPerformManagedDependencyUpgrades; private readonly IDependencyManagerStorage _storage; private readonly IDependencySnapshotInstaller _installer; @@ -33,11 +31,14 @@ internal class BackgroundDependencySnapshotMaintainer : IBackgroundDependencySna public BackgroundDependencySnapshotMaintainer( IDependencyManagerStorage storage, IDependencySnapshotInstaller installer, - IDependencySnapshotPurger purger) + IDependencySnapshotPurger purger, + Func getShouldPerformManagedDependencyUpgrades) { _storage = storage ?? throw new ArgumentNullException(nameof(storage)); _installer = installer ?? throw new ArgumentNullException(nameof(installer)); _purger = purger ?? throw new ArgumentNullException(nameof(purger)); + _getShouldPerformManagedDependencyUpgrades = getShouldPerformManagedDependencyUpgrades; + } public void Start(string currentSnapshotPath, DependencyManifestEntry[] dependencyManifest, ILogger logger) @@ -46,16 +47,6 @@ public void Start(string currentSnapshotPath, DependencyManifestEntry[] dependen _purger.SetCurrentlyUsedSnapshot(currentSnapshotPath, logger); - if (WorkerEnvironment.IsPowerShellSDKDeprecated() && !EnableAutomaticUpgrades) - { - logger.Log( - isUserOnlyLog: false, - RpcLog.Types.Level.Warning, - PowerShellWorkerStrings.AutomaticUpgradesAreDisabled); - - return; - } - _installAndPurgeTimer = new Timer( _ => InstallAndPurgeSnapshots(PowerShell.Create, logger), state: null, @@ -70,6 +61,23 @@ public string InstallAndPurgeSnapshots(Func pwshFactory, ILogger log { try { + if (!_getShouldPerformManagedDependencyUpgrades()) + { + logger.Log( + isUserOnlyLog: false, + RpcLog.Types.Level.Warning, + PowerShellWorkerStrings.AutomaticUpgradesAreDisabled); + + // Shutdown the timer that calls this method after the EOL date + if (_installAndPurgeTimer is not null) + { + _installAndPurgeTimer.Dispose(); + _installAndPurgeTimer = null; + } + + return null; + } + // Purge before installing a new snapshot, as we may be able to free some space. _purger.Purge(logger); diff --git a/src/DependencyManagement/DependencyManager.cs b/src/DependencyManagement/DependencyManager.cs index 682fb914..0cb5dd5c 100644 --- a/src/DependencyManagement/DependencyManager.cs +++ b/src/DependencyManagement/DependencyManager.cs @@ -70,7 +70,8 @@ public DependencyManager( maintainer ?? new BackgroundDependencySnapshotMaintainer( _storage, _installer, - new DependencySnapshotPurger(_storage)); + new DependencySnapshotPurger(_storage), + ShouldEnableManagedDpendencyUpgrades); _currentSnapshotContentLogger = currentSnapshotContentLogger ?? new BackgroundDependencySnapshotContentLogger(snapshotContentLogger); } @@ -129,6 +130,18 @@ internal string Initialize(ILogger logger) } } + /// + /// Determines whether the function app should enable automatic upgrades for managed dependencies + /// + /// + /// True if Managed Dependencies should be upgraded (SDK is not past it's deprecation date OR user has configured this behavior via MDEnableAutomaticUpgrades env var + /// False if Managed Dependencies should not be upgraded + /// + private bool ShouldEnableManagedDpendencyUpgrades() + { + return !WorkerEnvironment.IsPowerShellSDKDeprecated() || EnableAutomaticUpgrades; + } + /// /// Start dependency installation if needed. /// firstPowerShell is the first PowerShell instance created in this process (which this is important for local debugging), @@ -207,7 +220,7 @@ internal Exception InstallFunctionAppDependencies(PowerShell firstPwsh, Func())); using (var dummyPowerShell = PowerShell.Create()) - using (var maintainer = CreateMaintainerWithMocks(_minBackgroundUpgradePeriod)) + using (var maintainer = CreateMaintainerWithMocks(true, _minBackgroundUpgradePeriod)) { maintainer.Start("current snapshot", _dependencyManifest, _mockLogger.Object); @@ -73,6 +73,41 @@ public void InstallsSnapshotIfNoRecentlyInstalledSnapshotFound() } } + [Fact] + public void DoesNothingIfManagedDependenciesUpgradesAreDisabled() + { + _mockStorage.Setup(_ => _.GetInstalledAndInstallingSnapshots()).Returns(new[] { "older snapshot" }); + _mockStorage.Setup(_ => _.GetSnapshotCreationTimeUtc("older snapshot")) + .Returns(DateTime.UtcNow - _minBackgroundUpgradePeriod - TimeSpan.FromSeconds(1)); + + _mockStorage.Setup(_ => _.CreateNewSnapshotPath()).Returns("new snapshot path"); + + _mockInstaller.Setup( + _ => _.InstallSnapshot( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())); + + using (var dummyPowerShell = PowerShell.Create()) + using (var maintainer = CreateMaintainerWithMocks(false, _minBackgroundUpgradePeriod)) + { + maintainer.Start("current snapshot", _dependencyManifest, _mockLogger.Object); + + // ReSharper disable once AccessToDisposedClosure + var installedSnapshotPath = maintainer.InstallAndPurgeSnapshots(() => dummyPowerShell, _mockLogger.Object); + Assert.Equal("new snapshot path", installedSnapshotPath); + + // ReSharper disable once AccessToDisposedClosure + _mockInstaller.Verify( + _ => _.InstallSnapshot(_dependencyManifest, "new snapshot path", dummyPowerShell, DependencySnapshotInstallationMode.Optional, _mockLogger.Object), + Times.Never); + + _mockLogger.Verify(_ => _.Log(false, LogLevel.Warning, PowerShellWorkerStrings.AutomaticUpgradesAreDisabled, null), Times.Once); + } + } + [Fact] public void DoesNotInstallSnapshotIfRecentlyInstalledSnapshotFound() { @@ -80,7 +115,7 @@ public void DoesNotInstallSnapshotIfRecentlyInstalledSnapshotFound() _mockStorage.Setup(_ => _.GetSnapshotCreationTimeUtc("older snapshot")) .Returns(DateTime.UtcNow - _minBackgroundUpgradePeriod + TimeSpan.FromSeconds(1)); - using (var maintainer = CreateMaintainerWithMocks(_minBackgroundUpgradePeriod)) + using (var maintainer = CreateMaintainerWithMocks(true, _minBackgroundUpgradePeriod)) { maintainer.Start("current snapshot", _dependencyManifest, _mockLogger.Object); @@ -112,7 +147,7 @@ public void LogsWarningIfCannotInstallSnapshot() .Throws(injectedException); using (var dummyPowerShell = PowerShell.Create()) - using (var maintainer = CreateMaintainerWithMocks(_minBackgroundUpgradePeriod)) + using (var maintainer = CreateMaintainerWithMocks(true, _minBackgroundUpgradePeriod)) { maintainer.Start("current snapshot", _dependencyManifest, _mockLogger.Object); @@ -129,12 +164,13 @@ public void LogsWarningIfCannotInstallSnapshot() Times.Once); } - private BackgroundDependencySnapshotMaintainer CreateMaintainerWithMocks(TimeSpan? minBackgroundUpgradePeriod = null) + private BackgroundDependencySnapshotMaintainer CreateMaintainerWithMocks(bool shouldPerformManagedDependenciesUpgrades, TimeSpan? minBackgroundUpgradePeriod = null) { var maintainer = new BackgroundDependencySnapshotMaintainer( _mockStorage.Object, _mockInstaller.Object, - _mockPurger.Object); + _mockPurger.Object, + () => { return shouldPerformManagedDependenciesUpgrades; }); if (minBackgroundUpgradePeriod != null) { From f1164ea4d7f258de0587f8f4ed6c8bc8fa87968d Mon Sep 17 00:00:00 2001 From: Andy Staples Date: Wed, 7 Aug 2024 15:24:59 -0600 Subject: [PATCH 4/7] Revert InstallFunctionAppDependencies change --- src/DependencyManagement/DependencyManager.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/DependencyManagement/DependencyManager.cs b/src/DependencyManagement/DependencyManager.cs index 0cb5dd5c..a2bbe57f 100644 --- a/src/DependencyManagement/DependencyManager.cs +++ b/src/DependencyManagement/DependencyManager.cs @@ -220,16 +220,6 @@ internal Exception InstallFunctionAppDependencies(PowerShell firstPwsh, Func Date: Wed, 7 Aug 2024 15:30:35 -0600 Subject: [PATCH 5/7] Revert DependencyManagerTests change --- .../DependencyManagerTests.cs | 61 ++++++++----------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/test/Unit/DependencyManagement/DependencyManagerTests.cs b/test/Unit/DependencyManagement/DependencyManagerTests.cs index ec53d3dd..fbe8a13c 100644 --- a/test/Unit/DependencyManagement/DependencyManagerTests.cs +++ b/test/Unit/DependencyManagement/DependencyManagerTests.cs @@ -229,49 +229,40 @@ public void StartDependencyInstallationIfNeeded_InstallsSnapshotInForeground_Whe [Fact] public void StartDependencyInstallationIfNeeded_InvokesBackgroundMaintainer_WhenAcceptableDependenciesAlreadyInstalled() { - try - { - Environment.SetEnvironmentVariable("MDEnableAutomaticUpgrades", "true"); - - _mockInstalledDependenciesLocator.Setup(_ => _.GetPathWithAcceptableDependencyVersionsInstalled()) - .Returns("AlreadyInstalled"); - _mockStorage.Setup(_ => _.GetDependencies()).Returns(GetAnyNonEmptyDependencyManifestEntries()); - - var firstPowerShellRunspace = PowerShell.Create(); - Func powerShellFactory = PowerShell.Create; + _mockInstalledDependenciesLocator.Setup(_ => _.GetPathWithAcceptableDependencyVersionsInstalled()) + .Returns("AlreadyInstalled"); + _mockStorage.Setup(_ => _.GetDependencies()).Returns(GetAnyNonEmptyDependencyManifestEntries()); - _mockStorage.Setup(_ => _.SnapshotExists("AlreadyInstalled")).Returns(true); + var firstPowerShellRunspace = PowerShell.Create(); + Func powerShellFactory = PowerShell.Create; - _mockBackgroundDependencySnapshotMaintainer.Setup( - _ => _.InstallAndPurgeSnapshots(It.IsAny>(), It.IsAny())) - .Returns("NewSnapshot"); + _mockStorage.Setup(_ => _.SnapshotExists("AlreadyInstalled")).Returns(true); - using (var dependencyManager = CreateDependencyManagerWithMocks()) - { - dependencyManager.Initialize(_mockLogger.Object); - dependencyManager.StartDependencyInstallationIfNeeded(firstPowerShellRunspace, powerShellFactory, _mockLogger.Object); - var hadToWait = dependencyManager.WaitForDependenciesAvailability(() => _mockLogger.Object); + _mockBackgroundDependencySnapshotMaintainer.Setup( + _ => _.InstallAndPurgeSnapshots(It.IsAny>(), It.IsAny())) + .Returns("NewSnapshot"); - Assert.False(hadToWait); - Assert.Equal("NewSnapshot", dependencyManager.WaitForBackgroundDependencyInstallationTaskCompletion()); + using (var dependencyManager = CreateDependencyManagerWithMocks()) + { + dependencyManager.Initialize(_mockLogger.Object); + dependencyManager.StartDependencyInstallationIfNeeded(firstPowerShellRunspace, powerShellFactory, _mockLogger.Object); + var hadToWait = dependencyManager.WaitForDependenciesAvailability(() => _mockLogger.Object); - _mockBackgroundDependencySnapshotMaintainer.Verify( - _ => _.InstallAndPurgeSnapshots(powerShellFactory, _mockLogger.Object), - Times.Once); - } + Assert.False(hadToWait); + Assert.Equal("NewSnapshot", dependencyManager.WaitForBackgroundDependencyInstallationTaskCompletion()); - _mockLogger.Verify( - _ => _.Log( - false, - LogLevel.Trace, - It.Is(message => message.Contains(PowerShellWorkerStrings.AcceptableFunctionAppDependenciesAlreadyInstalled)), - It.IsAny()), + _mockBackgroundDependencySnapshotMaintainer.Verify( + _ => _.InstallAndPurgeSnapshots(powerShellFactory, _mockLogger.Object), Times.Once); } - finally - { - Environment.SetEnvironmentVariable("MDEnableAutomaticUpgrades", null); - } + + _mockLogger.Verify( + _ => _.Log( + false, + LogLevel.Trace, + It.Is(message => message.Contains(PowerShellWorkerStrings.AcceptableFunctionAppDependenciesAlreadyInstalled)), + It.IsAny()), + Times.Once); } [Fact] From 6f84a5208338cc7a34f096b45ebd65ba164d4320 Mon Sep 17 00:00:00 2001 From: Andy Staples Date: Wed, 7 Aug 2024 15:38:55 -0600 Subject: [PATCH 6/7] Fix test --- .../BackgroundDependencySnapshotMaintainerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Unit/DependencyManagement/BackgroundDependencySnapshotMaintainerTests.cs b/test/Unit/DependencyManagement/BackgroundDependencySnapshotMaintainerTests.cs index 9f70e6bc..b4a2619f 100644 --- a/test/Unit/DependencyManagement/BackgroundDependencySnapshotMaintainerTests.cs +++ b/test/Unit/DependencyManagement/BackgroundDependencySnapshotMaintainerTests.cs @@ -97,7 +97,7 @@ public void DoesNothingIfManagedDependenciesUpgradesAreDisabled() // ReSharper disable once AccessToDisposedClosure var installedSnapshotPath = maintainer.InstallAndPurgeSnapshots(() => dummyPowerShell, _mockLogger.Object); - Assert.Equal("new snapshot path", installedSnapshotPath); + Assert.Equal(null, installedSnapshotPath); // ReSharper disable once AccessToDisposedClosure _mockInstaller.Verify( From 5760972baf46018387401d7f2df4f48b52bdf1c4 Mon Sep 17 00:00:00 2001 From: Andy Staples Date: Wed, 25 Sep 2024 15:08:04 -0600 Subject: [PATCH 7/7] Add instructions for new PowerShell versions - Managed dependencies shutoff date must be updated --- create_new_worker_instructions.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 create_new_worker_instructions.md diff --git a/create_new_worker_instructions.md b/create_new_worker_instructions.md new file mode 100644 index 00000000..b3824a12 --- /dev/null +++ b/create_new_worker_instructions.md @@ -0,0 +1,6 @@ +## Instructions for Upgrading the PowerShell Language Worker to a New PowerShell SDK Minor Version (7.6+) +Once a new PowerShell SDK version is released on [GiHub](https://github.com/PowerShell/PowerShell/releases), follow these steps to upgrade the PowerShell SDK reference used by the language worker: + +- Update the solution targets as needed for whatever .NET version is targeted by the new PowerShell +- Follow instructions in upgrade_ps_sdk_instructions.md to update loosely linked dependencies in project files +- Update the Managed Dependency shutoff date in src/DependencyManagement/WorkerEnvironment.cs