WebAdministrationDsc icon indicating copy to clipboard operation
WebAdministrationDsc copied to clipboard

WebApplication: Integration test failing

Open nickgw opened this issue 3 years ago • 0 comments

Problem description

The two Get-DscConfiguration integration tests for WebApplication fail:

 It 'Should be able to call Get-DscConfiguration without throwing' {
      { Get-DscConfiguration -Verbose -ErrorAction Stop } | Should -Not -Throw
 }

Throws an error:

    [-] Should be able to call Get-DscConfiguration without throwing 5.24s
      Expected no exception to be thrown, but an exception "A general error occurred that is not covered by a more specific error code." was thrown from D:\a\1\s\tests\Integration\DSC_WebApplication.Integration.Tests.ps1:97 char:17
          +                 Get-DscConfiguration -Verbose -ErrorAction Stop
          +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
      98:             } | Should -Not -Throw
      at <ScriptBlock>, D:\a\1\s\tests\Integration\DSC_WebApplication.Integration.Tests.ps1: line 95

Verbose logs

[-] Should be able to call Get-DscConfiguration without throwing 5.24s
      Expected no exception to be thrown, but an exception "A general error occurred that is not covered by a more specific error code." was thrown from D:\a\1\s\tests\Integration\DSC_WebApplication.Integration.Tests.ps1:97 char:17
          +                 Get-DscConfiguration -Verbose -ErrorAction Stop
          +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
      98:             } | Should -Not -Throw
      at <ScriptBlock>, D:\a\1\s\tests\Integration\DSC_WebApplication.Integration.Tests.ps1: line 95


### DSC configuration

```powershell
#requires -Version 4
configuration DSC_WebApplication_Present
{
    Import-DscResource -ModuleName WebAdministrationDsc

    Node $AllNodes.NodeName
    {
        WebApplication WebApplication
        {
            Website = $Node.Website
            Ensure = 'Present'
            Name = $Node.WebApplication
            PhysicalPath = $Node.PhysicalPath
            WebAppPool = $Node.ApplicationPool
            ApplicationType = $Node.ApplicationType
            AuthenticationInfo = `
                DSC_WebApplicationAuthenticationInformation
                {
                    Anonymous = $Node.AuthenticationInfoAnonymous
                    Basic     = $Node.AuthenticationInfoBasic
                    Digest    = $Node.AuthenticationInfoDigest
                    Windows   = $Node.AuthenticationInfoWindows
                }
            PreloadEnabled = $Node.PreloadEnabled
            ServiceAutoStartEnabled = $Node.ServiceAutoStartEnabled
            ServiceAutoStartProvider = $Node.ServiceAutoStartProvider
            SslFlags = $Node.WebApplicationSslFlags
            EnabledProtocols = $Node.EnabledProtocols
        }
    }
}


### Suggested solution

refactor integration tests

### Operating system the target node is running

```text
All integration test OSes

PowerShell version and build the target node is running

5.1

xWebAdministration version

latest

nickgw avatar May 30 '22 21:05 nickgw