Skip to content

Commit

Permalink
xSQLServer: Fix integration tests. Added ErrorAction 'Stop' to the cm…
Browse files Browse the repository at this point in the history
…dlet Start-DscConfiguration (#826)

- Changes to xSQLServerAlwaysOnService
  - Fix integration tests. Added ErrorAction 'Stop' to the cmdlet Start-DscConfiguration (issue #824]).
- Changes to xSQLServerSetup
  - Fix integration tests. Added ErrorAction 'Stop' to the cmdlet Start-DscConfiguration (issue #824]).
  • Loading branch information
johlju authored Sep 20, 2017
1 parent 0be02ae commit c051158
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
more information in [issue #806](https://github.com/PowerShell/xFailOverCluster/issues/806)).
- Fixed wrong variable name for SQL service credential. It was using the
integration test variable name instead of the parameter name.
- Added ErrorAction 'Stop' to the cmdlet Start-DscConfiguration
([issue #824](https://github.com/PowerShell/xSQLServer/issues/824)).
- Changes to xSQLServerAlwaysOnAvailabilityGroup
- Change the check of the values entered as parameter for
BasicAvailabilityGroup. It is a boolean, hence it was not possible to
Expand All @@ -71,6 +73,8 @@
find the specified property ([issue #801](https://github.com/PowerShell/xSQLServer/issues/801))
- Changes to xSQLServerAlwaysOnService
- Added integration test ([issue #736](https://github.com/PowerShell/xSQLServer/issues/736)).
- Added ErrorAction 'Stop' to the cmdlet Start-DscConfiguration
([issue #824](https://github.com/PowerShell/xSQLServer/issues/824)).
- Added new resource xSQLServerAccount ([issue #706](https://github.com/PowerShell/xSQLServer/issues/706))
- Added localization support for all strings
- Added examples for usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,25 @@ try
Context ('When using configuration {0}' -f $configurationName) {
It 'Should compile and apply the MOF without throwing' {
{
# The variable $ConfigurationData was dot-sourced above.
& $configurationName `
-SqlInstallCredential $mockSqlInstallCredential `
-OutputPath $TestDrive `
-ConfigurationData $ConfigurationData

Start-DscConfiguration -Path $TestDrive `
-ComputerName localhost -Wait -Verbose -Force
$configurationParameters = @{
SqlInstallCredential = $mockSqlInstallCredential
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'
}

Start-DscConfiguration @startDscConfigurationParameters
} | Should Not Throw
}

Expand Down
33 changes: 22 additions & 11 deletions Tests/Integration/MSFT_xSQLServerSetup.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,28 @@ try
Describe "$($script:DSCResourceName)_Integration" {
It 'Should compile and apply the MOF without throwing' {
{
# The variable $ConfigurationData was dot-sourced above.
& $configurationName `
-SqlInstallCredential $mockSqlInstallCredential `
-SqlAdministratorCredential $mockSqlAdminCredential `
-SqlServiceCredential $mockSqlServiceCredential `
-SqlAgentServiceCredential $mockSqlAgentServiceCredential `
-OutputPath $TestDrive `
-ConfigurationData $ConfigurationData

Start-DscConfiguration -Path $TestDrive `
-ComputerName localhost -Wait -Verbose -Force
$configurationParameters = @{
SqlInstallCredential = $mockSqlInstallCredential
SqlAdministratorCredential = $mockSqlAdminCredential
SqlServiceCredential = $mockSqlServiceCredential
SqlAgentServiceCredential = $mockSqlAgentServiceCredential
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'
}

Start-DscConfiguration @startDscConfigurationParameters
} | Should Not Throw
} -ErrorVariable itBlockError

Expand Down

0 comments on commit c051158

Please sign in to comment.