Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Aug 31, 2021
1 parent 93e5ec0 commit f131148
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Integration/DSC_SqlRS.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,36 @@ try

$webRequestStatusCode | Should -BeExactly 200
}

It 'Should be able to access the Reports site without any error' {
if($script:sqlVersion -in @('140', '150'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportsUri = 'http://{0}/Reports' -f $env:COMPUTERNAME
}
else
{
$reportsUri = 'http://{0}/Reports_{1}' -f $env:COMPUTERNAME, $ConfigurationData.AllNodes.InstanceName
}

try
{
$webRequestReportServer = Invoke-WebRequest -Uri $reportsUri -UseDefaultCredentials
# if the request finishes successfully this should return status code 200.
$webRequestStatusCode = $webRequestReportServer.StatusCode -as [int]
}
catch
{
<#
If the request generated an exception i.e. "HTTP Error 503. The service is unavailable."
we can pull the status code from the Exception.Response property.
#>
$webRequestResponse = $_.Exception.Response
$webRequestStatusCode = $webRequestResponse.StatusCode -as [int]
}

$webRequestStatusCode | Should -BeExactly 200
}
}

$configurationName = "$($script:dscResourceName)_StopReportingServicesInstance_Config"
Expand Down

0 comments on commit f131148

Please sign in to comment.