dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
360 stars 225 forks source link

SqlRs: Integration test fails on SQL Server 2022 #2009

Open johlju opened 6 months ago

johlju commented 6 months ago

Problem description

The integration tests for SqlRS has started to fail when integration tests run the tests for SQL Server 2022. Something has changed but unclear what.

Verbose logs

##[error]    [-] Should compile and apply the MOF without throwing 38.72s (38.71s|11ms)
##[error]     Expected no exception to be thrown, but an exception "PowerShell DSC resource DSC_SqlRS  failed to execute Set-TargetResource functionality with error message: The parameter is incorrect.  " was thrown from D:\a\1\s\tests\Integration\DSC_SqlRS_Default.Integration.Tests.ps1:151 char:17
##[error]         + ...               Start-DscConfiguration @startDscConfigurationParameters
##[error]         +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
##[error]     at } | Should -Not -Throw, D:\a\1\s\tests\Integration\DSC_SqlRS_Default.Integration.Tests.ps1:152

DSC configuration

# See integration test: https://github.com/dsccommunity/SqlServerDsc/blob/026647ca36ce154a86facf195d00c27c2668281a/tests/Integration/DSC_SqlRS_Default.config.ps1#L169C1-L194C2

Configuration DSC_SqlRS_ConfigureReportingServices_Config
{
    Import-DscResource -ModuleName 'SqlServerDsc'

    node $AllNodes.NodeName
    {
        SqlRS 'Integration_Test'
        {
            # Instance name for the Reporting Services.
            InstanceName         = $Node.InstanceName

            <#
                Instance for Reporting Services databases.
                Note: This instance is created in a prior integration test.
            #>
            DatabaseServerName   = $Node.DatabaseServerName
            DatabaseInstanceName = $Node.DatabaseInstanceName
            Encrypt              = 'Optional'

            PsDscRunAsCredential = New-Object `
                -TypeName System.Management.Automation.PSCredential `
                -ArgumentList @(
                    $Node.RunAs_UserName, (ConvertTo-SecureString -String $Node.RunAs_Password -AsPlainText -Force))
        }
    }
}

Suggested solution

Unknown. Something has changed with SQL Server 2022 and work has to be done to pin point exact cause.

SQL Server edition and version

# Integration tests for SQL Server 2022 installs this version: https://github.com/dsccommunity/SqlServerDsc/blob/026647ca36ce154a86facf195d00c27c2668281a/tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1#L79-L80

SQL Server PowerShell modules

SqlServer that the integration tests installs.

Operating system

Fails on both Windows Server 2019 and Windows Server 2022.

PowerShell version

5.1

SqlServerDsc version

Code from main branch
johlju commented 6 months ago

There seems to be an issue with the SqlRS resource not working on the SQL Server 2022 instances that are installed as part of the integration tests. This will prevent us from merging PR's to the main branch because it fail to release a new preview release.

I won't have time looking into what causing the error.

johlju commented 6 months ago

Worst case we have to disable the tests.

johlju commented 6 months ago

The PR #2008 has temporarily disabled the tests that fails. They should be re-enabled when this issue is resolved.

https://github.com/dsccommunity/SqlServerDsc/blob/3ef838b2dbcf32e977b2186633bde7428249e2a1/tests/Integration/DSC_SqlRS.Integration.Tests.ps1#L81-L82

https://github.com/dsccommunity/SqlServerDsc/blob/3ef838b2dbcf32e977b2186633bde7428249e2a1/tests/Integration/DSC_SqlRS_Default.Integration.Tests.ps1#L81-L82