From 16501b149485b0bd8fb504c3da1560eb5fa38e1c Mon Sep 17 00:00:00 2001 From: OS-tiagobarroso <102374678+OS-tiagobarroso@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:04:05 +0100 Subject: [PATCH] R11PIT-775 - Update hosting bundle from .NET Core 3.1 to .NET 6.0 (#112) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * R11PIT-775 - Update hosting bundle from .NET Core 3.1 to .NET 6.0 * Update comments * Update wrong version * Fix comment * Bumped version and updated CHANGELOG Co-authored-by: Luísa Lourenço --- CHANGELOG.md | 4 + appveyor.yml | 2 +- .../Functions/Get-OSServerPreReqs.ps1 | 63 ++++- .../Functions/Install-OSServerPreReqs.ps1 | 89 ++++++- src/Outsystems.SetupTools/Lib/Constants.ps1 | 10 + .../Lib/PlatformSetup.ps1 | 60 +++++ .../OutSystems.SetupTools.psd1 | 2 +- test/unit/Install-OSServerPreReqs.Tests.ps1 | 229 ++++++++++++++++++ 8 files changed, 447 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b06c2e..5e10d88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Outsystems.SetupTools Release History +## 3.16.0.0 + +- Upgrade the hosting bundle to .NET 6.0 + ## 3.15.0.0 - Fix lifetime installer checks diff --git a/appveyor.yml b/appveyor.yml index 83ba9c5..c690e86 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 3.15.0.{build} +version: 3.16.0.{build} only_commits: files: diff --git a/src/Outsystems.SetupTools/Functions/Get-OSServerPreReqs.ps1 b/src/Outsystems.SetupTools/Functions/Get-OSServerPreReqs.ps1 index b73b011..915353e 100644 --- a/src/Outsystems.SetupTools/Functions/Get-OSServerPreReqs.ps1 +++ b/src/Outsystems.SetupTools/Functions/Get-OSServerPreReqs.ps1 @@ -163,28 +163,39 @@ function Get-OSServerPreReqs } default { - # Check .NET Core Windows Server Hosting version + # Check .NET Core / .NET Windows Server Hosting version $fullVersion = [version]"$MajorVersion.$MinorVersion.$PatchVersion.0" if ($fullVersion -eq [version]"$MajorVersion.0.0.0") { # Here means that no specific minor and patch version were specified - # So we install both versions + # So we install all versions $requireDotNetCoreHostingBundle2 = $true $requireDotNetCoreHostingBundle3 = $true + $requireDotNetHostingBundle6 = $true + } + elseif ($fullVersion -ge [version]"11.17.1.0") + { + # Here means that minor and patch version were specified and we are equal or above version 11.17.1.0 + # We install .NET 6.0 only + $requireDotNetCoreHostingBundle2 = $false + $requireDotNetCoreHostingBundle3 = $false + $requireDotNetHostingBundle6 = $true } elseif ($fullVersion -ge [version]"11.12.2.0") { # Here means that minor and patch version were specified and we are equal or above version 11.12.2.0 - # We install version 3 only + # We install .NET Core 3.1 only $requireDotNetCoreHostingBundle2 = $false $requireDotNetCoreHostingBundle3 = $true + $requireDotNetHostingBundle6 = $false } else { # Here means that minor and patch version were specified and we are below version 11.12.2.0 - # We install version 2 only + # We install .NET Core 2.1 only $requireDotNetCoreHostingBundle2 = $true $requireDotNetCoreHostingBundle3 = $false + $requireDotNetHostingBundle6 = $false } if($requireDotNetCoreHostingBundle2) { @@ -194,7 +205,7 @@ function Get-OSServerPreReqs $Status = $False foreach ($version in GetDotNetCoreHostingBundleVersions) { - # Check version 2.1 + # Check .NET Core 2.1 if (([version]$version).Major -eq 2 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['2']['Version']) { $Status = $True } @@ -234,7 +245,7 @@ function Get-OSServerPreReqs $Status = $False foreach ($version in GetDotNetCoreHostingBundleVersions) { - # Check version 3.1 + # Check .NET Core 3.1 if (([version]$version).Major -eq 3 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['3']['Version']) { $Status = $True } @@ -263,6 +274,46 @@ function Get-OSServerPreReqs } + return $(CreateResult -Status $Status -IISStatus $IISStatus -OKMessages $OKMessages -NOKMessages $NOKMessages) + } + } + + if ($requireDotNetHostingBundle6) { + $RequirementStatuses += CreateRequirementStatus -Title ".NET 6.0 Windows Server Hosting" ` + -ScriptBlock ` + { + $Status = $False + foreach ($version in GetDotNetHostingBundleVersions) + { + # Check version 6.0 + if (([version]$version).Major -eq 6 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['6']['Version']) { + $Status = $True + } + } + $OKMessages = @("Minimum .NET 6.0.6 Windows Server Hosting found.") + $NOKMessages = @("Minimum .NET 6.0.6 Windows Server Hosting not found.") + $IISStatus = $True + + if (Get-Command Get-WebGlobalModule -errorAction SilentlyContinue) + { + $aspModules = Get-WebGlobalModule | Where-Object { $_.Name -eq "aspnetcoremodulev2" } + if ($Status) + { + # Check if IIS can find ASP.NET modules + if ($aspModules.Count -lt 1) + { + $Status = $False + $IISStatus = $False + $NOKMessages = @("IIS can't find ASP.NET modules") + } + else + { + $IISStatus = $True + } + } + } + + return $(CreateResult -Status $Status -IISStatus $IISStatus -OKMessages $OKMessages -NOKMessages $NOKMessages) } } diff --git a/src/Outsystems.SetupTools/Functions/Install-OSServerPreReqs.ps1 b/src/Outsystems.SetupTools/Functions/Install-OSServerPreReqs.ps1 index 864658d..68a1ccc 100644 --- a/src/Outsystems.SetupTools/Functions/Install-OSServerPreReqs.ps1 +++ b/src/Outsystems.SetupTools/Functions/Install-OSServerPreReqs.ps1 @@ -146,14 +146,23 @@ function Install-OSServerPreReqs } default { - # Check .NET Core Windows Server Hosting version + # Check .NET Core / .NET Windows Server Hosting version $fullVersion = [version]"$MajorVersion.$MinorVersion.$PatchVersion.0" if ($fullVersion -eq [version]"$MajorVersion.0.0.0") { # Here means that no specific minor and patch version were specified - # So we install both versions + # So we install all versions $installDotNetCoreHostingBundle2 = $true $installDotNetCoreHostingBundle3 = $true + $installDotNetHostingBundle6 = $true + } + elseif ($fullVersion -ge [version]"11.17.1.0") + { + # Here means that minor and patch version were specified and we are equal or above version 11.17.1.0 + # We install .NET 6.0 only + $installDotNetCoreHostingBundle2 = $false + $installDotNetCoreHostingBundle3 = $false + $installDotNetHostingBundle6 = $true } elseif ($fullVersion -ge [version]"11.12.2.0") { @@ -161,6 +170,7 @@ function Install-OSServerPreReqs # We install version 3 only $installDotNetCoreHostingBundle2 = $false $installDotNetCoreHostingBundle3 = $true + $installDotNetHostingBundle6 = $false } else { @@ -168,25 +178,38 @@ function Install-OSServerPreReqs # We install version 2 only $installDotNetCoreHostingBundle2 = $true $installDotNetCoreHostingBundle3 = $false + $installDotNetHostingBundle6 = $false } foreach ($version in GetDotNetCoreHostingBundleVersions) { - # Check version 2.1 + # Check .NET Core 2.1 if (([version]$version).Major -eq 2 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['2']['Version']) { $installDotNetCoreHostingBundle2 = $false } - # Check version 3.1 + # Check .NET Core 3.1 if (([version]$version).Major -eq 3 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['3']['Version']) { $installDotNetCoreHostingBundle3 = $false } } + + foreach ($version in GetDotNetHostingBundleVersions) + { + # Check .NET 6.0 + if (([version]$version).Major -eq 6 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['6']['Version']) { + $installDotNetHostingBundle6 = $false + } + } + if ($installDotNetCoreHostingBundle2) { LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Minimum .NET Core Windows Server Hosting version 2.1 for OutSystems $MajorVersion not found. We will try to download and install the latest .NET Core Windows Server Hosting bundle" } if ($installDotNetCoreHostingBundle3) { LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Minimum .NET Core Windows Server Hosting version 3.1 for OutSystems $MajorVersion not found. We will try to download and install the latest .NET Core Windows Server Hosting bundle" } + if ($installDotNetHostingBundle6) { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Minimum .NET Windows Server Hosting version 6.0.6 for OutSystems $MajorVersion not found. We will try to download and install the latest .NET Windows Server Hosting bundle" + } } } @@ -423,6 +446,64 @@ function Install-OSServerPreReqs } } + # Install .NET Windows Server Hosting bundle version 6 + if ($installDotNetHostingBundle6) + { + try + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Installing .NET 6.0 Windows Server Hosting bundle" + $exitCode = InstallDotNetHostingBundle -MajorVersion '6' -Sources $SourcePath + } + catch [System.IO.FileNotFoundException] + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Exception $_.Exception -Stream 3 -Message ".NET 6.0 installer not found" + WriteNonTerminalError -Message ".NET 6.0 installer not found" + + $installResult.Success = $false + $installResult.ExitCode = -1 + $installResult.Message = '.NET 6.0 installer not found' + + return $installResult + } + catch + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Exception $_.Exception -Stream 3 -Message "Error downloading or starting the .NET 6.0 installation" + WriteNonTerminalError -Message "Error downloading or starting the .NET 6.0 installation" + + $installResult.Success = $false + $installResult.ExitCode = -1 + $installResult.Message = 'Error downloading or starting the .NET 6.0 installation' + + return $installResult + } + + switch ($exitCode) + { + 0 + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message ".NET 6.0 Windows Server Hosting bundle successfully installed." + } + + { $_ -in 3010, 3011 } + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message ".NET 6.0 Windows Server Hosting bundle successfully installed but a reboot is needed. Exit code: $exitCode" + $installResult.RebootNeeded = $true + } + + default + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 3 -Message "Error installing .NET 6.0 Windows Server Hosting bundle. Exit code: $exitCode" + WriteNonTerminalError -Message "Error installing .NET 6.0 Windows Server Hosting bundle. Exit code: $exitCode" + + $installResult.Success = $false + $installResult.ExitCode = $exitCode + $installResult.Message = 'Error installing .NET 6.0 Windows Server Hosting bundle' + + return $installResult + } + } + } + # Install .NET if ($installDotNet) { diff --git a/src/Outsystems.SetupTools/Lib/Constants.ps1 b/src/Outsystems.SetupTools/Lib/Constants.ps1 index 03e150b..9168043 100644 --- a/src/Outsystems.SetupTools/Lib/Constants.ps1 +++ b/src/Outsystems.SetupTools/Lib/Constants.ps1 @@ -127,6 +127,16 @@ $OSDotNetCoreHostingBundleReq = @{ } } +# .NET Hosting Bundle related +[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')] +$OSDotNetHostingBundleReq = @{ + '6' = @{ + Version = '6.0.6' + ToInstallDownloadURL = 'https://download.visualstudio.microsoft.com/download/pr/0d000d1b-89a4-4593-9708-eb5177777c64/cfb3d74447ac78defb1b66fd9b3f38e0/dotnet-hosting-6.0.6-win.exe' + InstallerName = 'DotNet_WindowsHosting_6.exe' + } +} + # Database default timeout [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')] $OSDBTimeout = "60" diff --git a/src/Outsystems.SetupTools/Lib/PlatformSetup.ps1 b/src/Outsystems.SetupTools/Lib/PlatformSetup.ps1 index d30789e..76d2fe1 100644 --- a/src/Outsystems.SetupTools/Lib/PlatformSetup.ps1 +++ b/src/Outsystems.SetupTools/Lib/PlatformSetup.ps1 @@ -133,6 +133,32 @@ function GetDotNetCoreHostingBundleVersions() return $version } +function GetDotNetHostingBundleVersions() +{ + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Getting the contents of the registry key HKLM:SOFTWARE\WOW6432Node\Microsoft\Updates\.NET\Microsoft .Net<*>Windows Server Hosting<*>\PackageVersion" + + $rootPath = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET' + $filter = 'Microsoft .Net*Windows Server Hosting*' + + try + { + $version = $(Get-ChildItem -Path $rootPath -ErrorAction Stop | Where-Object { $_.PSChildName -like $filter } | Get-ItemProperty -ErrorAction Stop).PackageVersion | Sort-Object -Descending + } + catch + { + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message $($_.Exception.Message) + } + + if (-not $version) + { + $version = '0.0.0.0' + } + + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Returning $version" + + return $version +} + function InstallDotNet([string]$Sources, [string]$URL) { if ($Sources) @@ -431,6 +457,40 @@ function InstallDotNetCoreHostingBundle([string]$MajorVersion, [string]$Sources) return $($result.ExitCode) } +function InstallDotNetHostingBundle([string]$MajorVersion, [string]$Sources) +{ + if ($Sources) + { + if (Test-Path "$Sources\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName'])") + { + $installer = "$Sources\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName'])" + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Using local file: $installer" + } + # If Windows is set to hide file extensions from file names, the file could have been stored with double extension by mistake. + elseif (Test-Path "$Sources\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName']).exe") + { + $installer = "$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName']).exe" + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Using local fallback file: $installer" + } + else { + throw [System.IO.FileNotFoundException] "$installerName.exe not found." + } + } + else + { + $installer = "$ENV:TEMP\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName'])" + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Downloading sources from: $($script:OSDotNetHostingBundleReq[$MajorVersion]['ToInstallDownloadURL'])" + DownloadOSSources -URL $($script:OSDotNetHostingBundleReq[$MajorVersion]['ToInstallDownloadURL']) -SavePath $installer + } + + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Starting the installation" + $result = Start-Process -FilePath $installer -ArgumentList "/install", "/quiet", "/norestart" -Wait -PassThru -ErrorAction Stop + + LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Installation finished. Returnig $($result.ExitCode)" + + return $($result.ExitCode) +} + function InstallErlang([string]$InstallDir, [string]$Sources) { LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Starting the installation" diff --git a/src/Outsystems.SetupTools/OutSystems.SetupTools.psd1 b/src/Outsystems.SetupTools/OutSystems.SetupTools.psd1 index 818a9e1..0920c8b 100644 --- a/src/Outsystems.SetupTools/OutSystems.SetupTools.psd1 +++ b/src/Outsystems.SetupTools/OutSystems.SetupTools.psd1 @@ -12,7 +12,7 @@ RootModule = 'OutSystems.SetupTools.psm1' # Version number of this module. -ModuleVersion = '3.15.0.0' +ModuleVersion = '3.16.0.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/test/unit/Install-OSServerPreReqs.Tests.ps1 b/test/unit/Install-OSServerPreReqs.Tests.ps1 index e00dc63..065ec44 100644 --- a/test/unit/Install-OSServerPreReqs.Tests.ps1 +++ b/test/unit/Install-OSServerPreReqs.Tests.ps1 @@ -9,11 +9,13 @@ InModuleScope -ModuleName OutSystems.SetupTools { Mock GetMSBuildToolsInstallInfo { return @{ 'HasMSBuild2015' = $False; 'HasMSBuild2017' = $False; 'LatestVersionInstalled' = $Null; 'RebootNeeded' = $False } } Mock GetDotNet4Version { return $null } Mock GetDotNetCoreHostingBundleVersions { return '0.0.0.0' } + Mock GetDotNetHostingBundleVersions { return '0.0.0.0' } Mock InstallDotNet { return 0 } Mock InstallBuildTools { return 0 } Mock InstallWindowsFeatures { return @{ 'Output' = 'All good'; 'ExitCode' = @{ 'value__' = 0 }; 'RestartNeeded' = @{ 'value__' = 1 }; 'Success' = $true } } Mock InstallDotNetCoreHostingBundle { return 0 } + Mock InstallDotNetHostingBundle { return 0 } Mock ConfigureServiceWMI {} Mock ConfigureServiceWindowsSearch {} Mock DisableFIPS {} @@ -26,6 +28,8 @@ InModuleScope -ModuleName OutSystems.SetupTools { $assNotRunInstallBuildTools = @{ 'CommandName' = 'InstallBuildTools'; 'Times' = 0; 'Exactly' = $true; 'Scope' = 'Context'} $assRunInstallWindowsFeatures = @{ 'CommandName' = 'InstallWindowsFeatures'; 'Times' = 1; 'Exactly' = $true; 'Scope' = 'Context'} $assNotRunInstallWindowsFeatures = @{ 'CommandName' = 'InstallWindowsFeatures'; 'Times' = 0; 'Exactly' = $true; 'Scope' = 'Context'} + $assRunInstallDotNetHostingBundle = @{ 'CommandName' = 'InstallDotNetHostingBundle'; 'Times' = 1; 'Exactly' = $true; 'Scope' = 'Context'; 'ParameterFilter' = { $MajorVersion -eq "6" }} + $assNotRunInstallDotNetHostingBundle = @{ 'CommandName' = 'InstallDotNetHostingBundle'; 'Times' = 0; 'Exactly' = $true; 'Scope' = 'Context'; 'ParameterFilter' = { $MajorVersion -eq "6" }} $assRunInstallDotNetCore = @{ 'CommandName' = 'InstallDotNetCoreHostingBundle'; 'Times' = 1; 'Exactly' = $true; 'Scope' = 'Context'; 'ParameterFilter' = { $MajorVersion -eq "3" }} $assNotRunInstallDotNetCore = @{ 'CommandName' = 'InstallDotNetCoreHostingBundle'; 'Times' = 0; 'Exactly' = $true; 'Scope' = 'Context'; 'ParameterFilter' = { $MajorVersion -eq "3" }} $assRunInstallDotNetCore21 = @{ 'CommandName' = 'InstallDotNetCoreHostingBundle'; 'Times' = 1; 'Exactly' = $true; 'Scope' = 'Context'; 'ParameterFilter' = { $MajorVersion -eq "2" }} @@ -50,6 +54,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET 2.1 core installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should not run the .NET core installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -77,6 +82,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should not run the .NET core installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -101,6 +107,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should run the .NET core 2.1 installation' { Assert-MockCalled @assRunInstallDotNetCore21 } It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -121,6 +128,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Mock GetMSBuildToolsInstallInfo { return @{ 'HasMSBuild2015' = $True; 'HasMSBuild2017' = $False; 'LatestVersionInstalled' = 'MS Build Tools 2015'; 'RebootNeeded' = $False } } Mock GetDotNet4Version { return 461808 } Mock GetDotNetCoreHostingBundleVersions { return @('3.1.14', '2.1.12') } + Mock GetDotNetHostingBundleVersions { return @('6.0.6') } $result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue @@ -129,6 +137,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should not run the .NET core installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -153,6 +162,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should run the .NET core 2.1 installation' { Assert-MockCalled @assRunInstallDotNetCore21 } It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -173,6 +183,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Mock GetMSBuildToolsInstallInfo { return @{ 'HasMSBuild2015' = $True; 'HasMSBuild2017' = $False; 'LatestVersionInstalled' = 'MS Build Tools 2015'; 'RebootNeeded' = $False } } Mock GetDotNet4Version { return 461808 } Mock GetDotNetCoreHostingBundleVersions { return @('3.1.14', '2.1.12') } + Mock GetDotNetHostingBundleVersions { return @('6.0.6') } $result = Install-OSServerPreReqs -MajorVersion '12' -ErrorVariable err -ErrorAction SilentlyContinue @@ -181,6 +192,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should not run the .NET core installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -207,6 +219,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assNotRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -234,6 +247,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -261,6 +275,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -288,6 +303,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch Assert-MockCalled @assRunDisableFIPS @@ -315,6 +331,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -398,6 +415,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -425,6 +443,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -452,6 +471,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch Assert-MockCalled @assRunDisableFIPS @@ -479,6 +499,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -506,6 +527,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -533,6 +555,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch Assert-MockCalled @assRunDisableFIPS @@ -560,6 +583,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -576,6 +600,34 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '10' -ErrorAction SilentlyContinue } | Should Not throw } } + Context 'When .NET 6.0 installation fails to start' { + + Mock -CommandName InstallDotNetHostingBundle -ParameterFilter { $MajorVersion -eq "6" } -MockWith { throw 'Big error' } + $result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should not run the next actions' { + Assert-MockCalled @assNotRunInstallDotNet + Assert-MockCalled @assRunInstallBuildTools + Assert-MockCalled @assRunInstallWindowsFeatures + Assert-MockCalled @assRunInstallDotNetCore21 + Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle + Assert-MockCalled @assNotRunConfigureServiceWMI + Assert-MockCalled @assNotRunConfigureServiceWindowsSearch + Assert-MockCalled @assNotRunDisableFIPS + Assert-MockCalled @assNotRunConfigureWindowsEventLog + Assert-MockCalled @assNotRunConfigureMSMQDomainServer + } + It 'Should return the right result' { + $result.Success | Should Be $false + $result.RebootNeeded | Should Be $false + $result.ExitCode | Should Be -1 + $result.Message | Should Be 'Error downloading or starting the .NET 6.0 installation' + } + It 'Should output an error' { $err[-1] | Should Be 'Error downloading or starting the .NET 6.0 installation' } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } + } + Context 'When .NET core installation fails to start' { Mock -CommandName InstallDotNetCoreHostingBundle -ParameterFilter { $MajorVersion -eq "3" } -MockWith { throw 'Big error' } @@ -587,6 +639,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -614,6 +667,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -630,6 +684,34 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } } + Context 'When .NET 6.0 installer not found' { + + Mock -CommandName InstallDotNetHostingBundle -ParameterFilter { $MajorVersion -eq "6" } -MockWith { throw [System.IO.FileNotFoundException] '.NET 6.0 installer not found' } + $result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should not run the next actions' { + Assert-MockCalled @assNotRunInstallDotNet + Assert-MockCalled @assRunInstallBuildTools + Assert-MockCalled @assRunInstallWindowsFeatures + Assert-MockCalled @assRunInstallDotNetCore21 + Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle + Assert-MockCalled @assNotRunConfigureServiceWMI + Assert-MockCalled @assNotRunConfigureServiceWindowsSearch + Assert-MockCalled @assNotRunDisableFIPS + Assert-MockCalled @assNotRunConfigureWindowsEventLog + Assert-MockCalled @assNotRunConfigureMSMQDomainServer + } + It 'Should return the right result' { + $result.Success | Should Be $false + $result.RebootNeeded | Should Be $false + $result.ExitCode | Should Be -1 + $result.Message | Should Be '.NET 6.0 installer not found' + } + It 'Should output an error' { $err[-1] | Should Be '.NET 6.0 installer not found' } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } + } + Context 'When .NET core installer not found' { Mock -CommandName InstallDotNetCoreHostingBundle -ParameterFilter { $MajorVersion -eq "3" } -MockWith { throw [System.IO.FileNotFoundException] '.NET Core 3.1 installer not found' } @@ -641,6 +723,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -668,6 +751,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -684,6 +768,34 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } } + Context 'When .NET 6.0 reports a reboot' { + + Mock -CommandName InstallDotNetHostingBundle -ParameterFilter { $MajorVersion -eq "6" } -MockWith { return 3010 } + $result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should run every action' { + Assert-MockCalled @assRunInstallDotNet + Assert-MockCalled @assRunInstallBuildTools + Assert-MockCalled @assRunInstallWindowsFeatures + Assert-MockCalled @assRunInstallDotNetCore21 + Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle + Assert-MockCalled @assRunConfigureServiceWMI + Assert-MockCalled @assRunConfigureServiceWindowsSearch + Assert-MockCalled @assRunDisableFIPS + Assert-MockCalled @assRunConfigureWindowsEventLog + Assert-MockCalled @assNotRunConfigureMSMQDomainServer + } + It 'Should return the right result' { + $result.Success | Should Be $true + $result.RebootNeeded | Should Be $true + $result.ExitCode | Should Be 3010 + $result.Message | Should Be 'Outsystems platform server pre-requisites successfully installed but a reboot is required' + } + It 'Should not output an error' { $err.Count | Should Be 0 } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } + } + Context 'When .NET core reports a reboot' { Mock -CommandName InstallDotNetCoreHostingBundle -ParameterFilter { $MajorVersion -eq "3" } -MockWith { return 3010 } @@ -695,6 +807,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch Assert-MockCalled @assRunDisableFIPS @@ -722,6 +835,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch Assert-MockCalled @assRunDisableFIPS @@ -738,6 +852,34 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } } + Context 'When .NET 6.0 reports an error' { + + Mock -CommandName InstallDotNetHostingBundle -ParameterFilter { $MajorVersion -eq "6" } -MockWith { return 10 } + $result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should not run the next actions' { + Assert-MockCalled @assNotRunInstallDotNet + Assert-MockCalled @assRunInstallBuildTools + Assert-MockCalled @assRunInstallWindowsFeatures + Assert-MockCalled @assRunInstallDotNetCore21 + Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle + Assert-MockCalled @assNotRunConfigureServiceWMI + Assert-MockCalled @assNotRunConfigureServiceWindowsSearch + Assert-MockCalled @assNotRunDisableFIPS + Assert-MockCalled @assNotRunConfigureWindowsEventLog + Assert-MockCalled @assNotRunConfigureMSMQDomainServer + } + It 'Should return the right result' { + $result.Success | Should Be $false + $result.RebootNeeded | Should Be $false + $result.ExitCode | Should Be 10 + $result.Message | Should Be 'Error installing .NET 6.0 Windows Server Hosting bundle' + } + It 'Should output an error' { $err[-1] | Should Be 'Error installing .NET 6.0 Windows Server Hosting bundle. Exit code: 10' } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -ErrorAction SilentlyContinue } | Should Not throw } + } + Context 'When .NET core reports an error' { Mock -CommandName InstallDotNetCoreHostingBundle -ParameterFilter { $MajorVersion -eq "3" } -MockWith { return 10 } @@ -749,6 +891,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -776,6 +919,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assNotRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch Assert-MockCalled @assNotRunDisableFIPS @@ -802,6 +946,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallBuildTools Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assNotRunConfigureServiceWindowsSearch @@ -829,6 +974,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallBuildTools Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch @@ -856,6 +1002,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallBuildTools Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch @@ -884,6 +1031,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallBuildTools Assert-MockCalled @assRunInstallDotNetCore21 Assert-MockCalled @assRunInstallDotNetCore + Assert-MockCalled @assRunInstallDotNetHostingBundle Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch @@ -911,6 +1059,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { Assert-MockCalled @assRunInstallBuildTools Assert-MockCalled @assNotRunInstallDotNetCore21 Assert-MockCalled @assNotRunInstallDotNetCore + Assert-MockCalled @assNotRunInstallDotNetHostingBundle Assert-MockCalled @assRunInstallWindowsFeatures Assert-MockCalled @assRunConfigureServiceWMI Assert-MockCalled @assRunConfigureServiceWindowsSearch @@ -937,6 +1086,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should run the .NET core 3.1 installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -961,6 +1111,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should run the .NET core 2.1 installation' { Assert-MockCalled @assRunInstallDotNetCore21 } It 'Should not run the .NET core 3.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -985,6 +1136,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -1009,6 +1161,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } @@ -1024,6 +1177,81 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '13' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw } } + Context 'When trying to install prerequisites for a OS 11 version in Minor version 17 and Patch version newer than 1 (11.17.2)' { + + $result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '17' -PatchVersion '2' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet } + It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools } + It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } + It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } + It 'Should not run the .NET core 3.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assRunInstallDotNetHostingBundle } + It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } + It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } + It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } + It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog } + It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer } + + It 'Should return the right result' { + $result.Success | Should Be $true + $result.RebootNeeded | Should Be $false + $result.ExitCode | Should Be 0 + $result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed' + } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '17' -PatchVersion '2' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw } + } + + Context 'When trying to install prerequisites for a OS 11 version in Minor version 17 and Patch version older than 1 (11.17.0)' { + + $result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '17' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet } + It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools } + It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } + It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } + It 'Should run the .NET core 3.1 installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle } + It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } + It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } + It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } + It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog } + It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer } + + It 'Should return the right result' { + $result.Success | Should Be $true + $result.RebootNeeded | Should Be $false + $result.ExitCode | Should Be 0 + $result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed' + } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '17' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw } + } + + Context 'When trying to install prerequisites for a OS 11 version in Minor version 17 and Patch version 1 (11.17.1)' { + + $result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '17' -PatchVersion '1' -ErrorVariable err -ErrorAction SilentlyContinue + + It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet } + It 'Should run the BuildTools installation' { Assert-MockCalled @assRunInstallBuildTools } + It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } + It 'Should not run the .NET core 2.1 installation' { Assert-MockCalled @assNotRunInstallDotNetCore21 } + It 'Should not run the .NET core installation' { Assert-MockCalled @assNotRunInstallDotNetCore } + It 'Should run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assRunInstallDotNetHostingBundle } + It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } + It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } + It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS } + It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog } + It 'Should not configure the MSMQ' { Assert-MockCalled @assNotRunConfigureMSMQDomainServer } + + It 'Should return the right result' { + $result.Success | Should Be $true + $result.RebootNeeded | Should Be $false + $result.ExitCode | Should Be 0 + $result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed' + } + It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '17' -PatchVersion '1' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw } + } + Context 'When trying to install prerequisites for a OS 11 version without passing the optional Minor and Patch Versions' { $result = Install-OSServerPreReqs -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue @@ -1033,6 +1261,7 @@ InModuleScope -ModuleName OutSystems.SetupTools { It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures } It 'Should run the .NET core 2.1 installation' { Assert-MockCalled @assRunInstallDotNetCore21} It 'Should run the .NET core installation' { Assert-MockCalled @assRunInstallDotNetCore } + It 'Should run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assRunInstallDotNetHostingBundle } It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI } It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch } It 'Should disable the FIPS' { Assert-MockCalled @assRunDisableFIPS }