dsccommunity / StorageDsc

DSC resource module is used to manage storage on Windows Servers.
https://dsccommunity.org
MIT License
71 stars 52 forks source link

Fix Failing Tests due to changes in DSCResource.Tests #118

Closed PlagueHO closed 7 years ago

PlagueHO commented 7 years ago

A recent change in DSCResource.Tests (https://github.com/PowerShell/DscResource.Tests/pull/186) caused the unit tests for the DSCResource.Tests module itself to be executed during the test run in this module.

For non-harness type modules this is being fixed in DSCResource.Tests itself, but for harness type, this must be fixed using this suggested change: https://github.com/PowerShell/xNetworking/pull/263#issuecomment-326367362

If you replace these rows

https://github.com/PowerShell/xStorage/blob/f0d5551c5ad830c29dd27b20a21954df5a3ec2c8/Tests/TestHarness.psm1#L44-L47

With these rows, it will not run the test that is failing

    if ($PSBoundParameters.ContainsKey('DscTestsPath') -eq $true)
    {
        $getChildItemParameters = @{
            Path = $DscTestsPath
            Recurse = $true
            Filter = '*.Tests.ps1'
        }

        # Get all tests '*.Tests.ps1'.
        $commonTestFiles = Get-ChildItem @getChildItemParameters

        # Remove DscResource.Tests unit and integration tests.
        $commonTestFiles = $commonTestFiles | Where-Object -FilterScript {
            $_.FullName -notmatch 'DSCResource.Tests\\Tests'
        }

        $testsToRun += @( $commonTestFiles.FullName )
    }