Skip to content

Commit

Permalink
Merge pull request #340 from PlagueHO/Issue-329
Browse files Browse the repository at this point in the history
Improve integration test reliability - Fixes #329
  • Loading branch information
PlagueHO authored Jun 28, 2020
2 parents 47d9409 + 2985eaa commit 8cefd68
Show file tree
Hide file tree
Showing 15 changed files with 408 additions and 198 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- ComputerManagementDsc
- Updated to use the common module _DscResource.Common_ - Fixes [Issue #327](https://github.com/dsccommunity/ComputerManagementDsc/issues/327).
- Fixed build failures caused by changes in `ModuleBuilder` module v1.7.0
Expand All @@ -14,6 +16,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ScheduledTask
- Add "StopExisting" to valid values for MultipleInstances parameter - Fixes [Issue #333](https://github.com/dsccommunity/ComputerManagementDsc/issues/333).

### Fixed

- ComputerManagementDsc
- Improved integration test reliability by resetting the DSC LCM
before executing each test using the `Reset-DscLcm` function - Fixes [Issue #329](https://github.com/dsccommunity/ComputerManagementDsc/issues/329).
- Split integration test MOF compilation out of application to standardize
pattern and make it easier to determine cause of failure.

## [8.2.0] - 2020-05-05

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ try
-OutputPath $TestDrive `
-ConfigurationData $configData

Reset-DscLcm

$startDscConfigurationParameters = @{
Path = $TestDrive
ComputerName = 'localhost'
Expand Down Expand Up @@ -82,11 +84,17 @@ try
)
}

It 'Should compile and apply the MOF without throwing' {
It 'Should compile the MOF without throwing' {
{
& "$($script:dscResourceName)_Config" `
-OutputPath $TestDrive `
-ConfigurationData $configData
} | Should -Not -Throw
}

It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

$startDscConfigurationParameters = @{
Path = $TestDrive
Expand Down
8 changes: 7 additions & 1 deletion tests/Integration/DSC_PendingReboot.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,17 @@ try
)
}

It 'Should compile and apply the MOF without throwing' {
It 'Should compile the MOF without throwing' {
{
& "$($script:dscResourceName)_Config" `
-OutputPath $TestDrive `
-ConfigurationData $configData
} | Should -Not -Throw
}

It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

$startDscConfigurationParameters = @{
Path = $TestDrive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ try
. $configFile

Describe "$($script:dscResourceName)_Integration" {
It 'Should compile and apply the MOF without throwing' {
It 'Should compile the MOF without throwing' {
{
& "$($script:dscResourceName)_Config" -OutputPath $TestDrive
} | Should -Not -Throw
}

It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

$startDscConfigurationParameters = @{
Path = $TestDrive
Expand Down
24 changes: 16 additions & 8 deletions tests/Integration/DSC_RemoteDesktopAdmin.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ try
$ConfigDir = (Join-Path -Path $TestDrive -ChildPath $CurrentConfig)
$ConfigMof = (Join-Path -Path $ConfigDir -ChildPath 'localhost.mof')

It 'Should compile a MOF file without error' {
It 'Should compile the MOF without throwing' {
{
. $CurrentConfig -OutputPath $ConfigDir
} | Should -Not -Throw
}

It 'Should apply the MOF correctly' {
It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

Start-DscConfiguration -Path $ConfigDir -Wait -Verbose -Force
} | Should -Not -Throw
}
Expand All @@ -66,14 +68,16 @@ try
$ConfigDir = (Join-Path -Path $TestDrive -ChildPath $CurrentConfig)
$ConfigMof = (Join-Path -Path $ConfigDir -ChildPath 'localhost.mof')

It 'Should compile a MOF file without error' {
It 'Should compile the MOF without throwing' {
{
. $CurrentConfig -OutputPath $ConfigDir
} | Should -Not -Throw
}

It 'Should apply the MOF correctly' {
It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

Start-DscConfiguration -Path $ConfigDir -Wait -Verbose -Force
} | Should -Not -Throw
}
Expand All @@ -98,14 +102,16 @@ try
$ConfigDir = (Join-Path -Path $TestDrive -ChildPath $CurrentConfig)
$ConfigMof = (Join-Path -Path $ConfigDir -ChildPath 'localhost.mof')

It 'Should compile a MOF file without error' {
It 'Should compile the MOF without throwing' {
{
. $CurrentConfig -OutputPath $ConfigDir
} | Should -Not -Throw
}

It 'Should apply the MOF correctly' {
It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

Start-DscConfiguration -Path $ConfigDir -Wait -Verbose -Force
} | Should -Not -Throw
}
Expand All @@ -132,14 +138,16 @@ try
$ConfigDir = (Join-Path -Path $TestDrive -ChildPath $CurrentConfig)
$ConfigMof = (Join-Path -Path $ConfigDir -ChildPath 'localhost.mof')

It 'Should compile a MOF file without error' {
It 'Should compile the MOF without throwing' {
{
. $CurrentConfig -OutputPath $ConfigDir
} | Should -Not -Throw
}

It 'Should apply the MOF correctly' {
It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

Start-DscConfiguration -Path $ConfigDir -Wait -Verbose -Force
} | Should -Not -Throw
}
Expand Down
17 changes: 17 additions & 0 deletions tests/Integration/DSC_ScheduledTask.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -97,6 +99,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -126,6 +130,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -162,6 +168,9 @@ try
It 'Should apply the MOF correctly in New Zealand Standard Time Timezone' {
{
Set-TimeZoneId -TimeZoneId 'New Zealand Standard Time'

Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -212,6 +221,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -259,6 +270,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -313,6 +326,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down Expand Up @@ -352,6 +367,8 @@ try

It 'Should apply the MOF correctly' {
{
Reset-DscLcm

Start-DscConfiguration `
-Path $configDir `
-Wait `
Expand Down
8 changes: 7 additions & 1 deletion tests/Integration/DSC_SmbServerConfiguration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ try
)
}

It 'Should compile and apply the MOF without throwing' {
It 'Should compile the MOF without throwing' {
{
& "$($script:dscResourceName)_Config" `
-OutputPath $TestDrive `
-ConfigurationData $configData
} | Should -Not -Throw
}

It 'Should apply the MOF without throwing' {
{
Reset-DscLcm

$startDscConfigurationParameters = @{
Path = $TestDrive
Expand Down
Loading

0 comments on commit 8cefd68

Please sign in to comment.