diff --git a/CHANGELOG.md b/CHANGELOG.md index 2761e64cd..5525b5e4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ [issue #1260](https://github.com/PowerShell/SqlServerDsc/issues/1260) in the previous release, as it only mitigated the issue, it did not solve the issue. +- Changes to SqlSetup + - Updated the integration test to stop the named instance while installing + the other instances to mitigate + [issue #1260](https://github.com/PowerShell/SqlServerDsc/issues/1260). ## 12.2.0.0 diff --git a/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 b/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 index f542dc88d..f9ac12900 100644 --- a/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 @@ -317,7 +317,7 @@ try } } - $configurationName = "$($script:DSCResourceName)_StopMultiAnalysisServicesInstance_Config" + $configurationName = "$($script:DSCResourceName)_StopServicesInstance_Config" Context ('When using configuration {0}' -f $configurationName) { It 'Should compile and apply the MOF without throwing' { @@ -654,6 +654,41 @@ try } | Should -Not -Throw } } + + $configurationName = "$($script:DSCResourceName)_StartServicesInstance_Config" + + Context ('When using configuration {0}' -f $configurationName) { + It 'Should compile and apply the MOF without throwing' { + { + $configurationParameters = @{ + OutputPath = $TestDrive + # The variable $ConfigurationData was dot-sourced above. + ConfigurationData = $ConfigurationData + } + + & $configurationName @configurationParameters + + $startDscConfigurationParameters = @{ + Path = $TestDrive + ComputerName = 'localhost' + Wait = $true + Verbose = $true + Force = $true + ErrorAction = 'Stop' + } + + try + { + Start-DscConfiguration @startDscConfigurationParameters + } + catch + { + Write-Verbose -Message ('{0} {1}' -f $integrationErrorMessagePrefix, $_) -Verbose + throw $_ + } + } | Should -Not -Throw + } + } } } finally diff --git a/Tests/Integration/MSFT_SqlSetup.config.ps1 b/Tests/Integration/MSFT_SqlSetup.config.ps1 index aef829505..15351b54d 100644 --- a/Tests/Integration/MSFT_SqlSetup.config.ps1 +++ b/Tests/Integration/MSFT_SqlSetup.config.ps1 @@ -231,17 +231,21 @@ Configuration MSFT_SqlSetup_InstallDatabaseEngineNamedInstanceAsSystem_Config } } -Configuration MSFT_SqlSetup_StopMultiAnalysisServicesInstance_Config +Configuration MSFT_SqlSetup_StopServicesInstance_Config { Import-DscResource -ModuleName 'PSDscResources' node localhost { - # Service ('StopSqlServerInstance{0}' -f $Node.DatabaseEngineNamedInstanceName) - # { - # Name = ('MSSQL${0}' -f $Node.DatabaseEngineNamedInstanceName) - # State = 'Stopped' - # } + <# + Stopping the Database Engine named instance. It will be restarted + at the end of the tests. + #> + Service ('StopSqlServerInstance{0}' -f $Node.DatabaseEngineNamedInstanceName) + { + Name = ('MSSQL${0}' -f $Node.DatabaseEngineNamedInstanceName) + State = 'Stopped' + } Service ('StopMultiAnalysisServicesInstance{0}' -f $Node.DatabaseEngineNamedInstanceName) { @@ -383,3 +387,18 @@ Configuration MSFT_SqlSetup_StopTabularAnalysisServices_Config } } } + +Configuration MSFT_SqlSetup_StartServicesInstance_Config +{ + Import-DscResource -ModuleName 'PSDscResources' + + node localhost + { + # Start the Database Engine named instance. + Service ('StartSqlServerInstance{0}' -f $Node.DatabaseEngineNamedInstanceName) + { + Name = ('MSSQL${0}' -f $Node.DatabaseEngineNamedInstanceName) + State = 'Running' + } + } +}