Skip to content

Commit

Permalink
Changes to SqlSetup
Browse files Browse the repository at this point in the history
- Updated the integration test to stop the named instance while installing
  the other instances to mitigate issue dsccommunity#1260.
  • Loading branch information
johlju committed Jan 15, 2019
1 parent 48ea219 commit db27c54
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
37 changes: 36 additions & 1 deletion Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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' {
Expand Down Expand Up @@ -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
Expand Down
31 changes: 25 additions & 6 deletions Tests/Integration/MSFT_SqlSetup.config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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'
}
}
}

0 comments on commit db27c54

Please sign in to comment.