Skip to content

Commit

Permalink
Add debug code in integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Aug 31, 2021
1 parent 91f71c5 commit 37f4104
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/Integration/DSC_SqlRS.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,73 @@ try
}

It 'Should be able to access the ReportServer site without any error' {
# Wait for 1 minute for the ReportServer to be ready.
Start-Sleep -Seconds 60

if ($script:sqlVersion -in @('140', '150'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportServerUri = 'http://{0}/ReportServer' -f $env:COMPUTERNAME
}
else
{
$reportServerUri = 'http://{0}/ReportServer_{1}' -f $env:COMPUTERNAME, $ConfigurationData.AllNodes.InstanceName
}

try
{
$webRequestReportServer = Invoke-WebRequest -Uri $reportServerUri -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
}

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
}

# TODO: Debug only
It 'Should be able to access the ReportServer site without any error' {
# Wait for 1 minute for the ReportServer to be ready.
Start-Sleep -Seconds 60

if ($script:sqlVersion -in @('140', '150'))
{
# SSRS 2017 and 2019 do not support multiple instances
Expand Down

0 comments on commit 37f4104

Please sign in to comment.