Skip to content

Commit

Permalink
SqlServerDsc: Integration tests for SQL Server Reporting Services 2022 (
Browse files Browse the repository at this point in the history
#1804)

- SqlServerDsc
  - Integration tests are now also run on SQL Server Reporting Services 2022.
  • Loading branch information
johlju authored Nov 27, 2022
1 parent 23064fa commit 8dde54d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New GitHub issue templates for proposing new public commands, proposing
an enhancement to an existing command, or having a problem with an existing
command.
- Integration tests are now also run on SQL Server 2022.
- Integration tests are now also run on SQL Server 2022 and SQL Server
Reporting Services 2022.
- Integration tests now wait for LCM after each It-block, not just at the
end of a Context-block. Hopefully this will mitigate some of the intermittent
errors we have seen when running the integration tests in the pipeline.
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/DSC_SqlAgentAlert.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ AfterAll {
Restore-TestEnvironment -TestEnvironment $script:testEnvironment
}

Describe "<dscResourceFriendlyName>_Integration" -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022', 'Integration_SQL2022') {
Describe "<dscResourceFriendlyName>_Integration" -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
BeforeAll {
$resourceId = "[$($script:dscResourceFriendlyName)]Integration_Test"
}
Expand Down
18 changes: 11 additions & 7 deletions tests/Integration/DSC_SqlRS.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ BeforeAll {
to run the correct tests depending of what version of SQL Server is
being tested in the current job.
#>
if (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2019')
if (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2022')
{
$script:sqlVersion = '160'
}
elseif (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2019')
{
$script:sqlVersion = '150'
}
Expand All @@ -60,7 +64,7 @@ AfterAll {
Get-Module -Name 'CommonTestHelper' -All | Remove-Module -Force
}

Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019') {
Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
BeforeAll {
$resourceId = "[$($script:dscResourceFriendlyName)]Integration_Test"
}
Expand Down Expand Up @@ -161,7 +165,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
# Wait for 1 minute for the ReportServer to be ready.
Start-Sleep -Seconds 30

if ($script:sqlVersion -in @('140', '150'))
if ($script:sqlVersion -in @('140', '150', '160'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportServerUri = 'http://{0}/ReportServer' -f $env:COMPUTERNAME
Expand Down Expand Up @@ -191,7 +195,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
}

It 'Should be able to access the Reports site without any error' {
if ($script:sqlVersion -in @('140', '150'))
if ($script:sqlVersion -in @('140', '150', '160'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportsUri = 'http://{0}/Reports' -f $env:COMPUTERNAME
Expand Down Expand Up @@ -281,7 +285,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
as this without testing for the correct error message on purpose.
#>
It 'Should not be able to access the ReportServer site and throw an error message' {
if ($script:sqlVersion -in @('140', '150'))
if ($script:sqlVersion -in @('140', '150', '160'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportServerUri = 'http://{0}/ReportServer' -f $env:COMPUTERNAME
Expand Down Expand Up @@ -349,7 +353,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
}

It 'Should be able to access the ReportServer site without any error' {
if ($script:sqlVersion -in @('140', '150'))
if ($script:sqlVersion -in @('140', '150', '160'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportServerUri = 'http://{0}/ReportServer' -f $env:COMPUTERNAME
Expand Down Expand Up @@ -379,7 +383,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
}

It 'Should be able to access the Reports site without any error' {
if ($script:sqlVersion -in @('140', '150'))
if ($script:sqlVersion -in @('140', '150', '160'))
{
# SSRS 2017 and 2019 do not support multiple instances
$reportsUri = 'http://{0}/Reports' -f $env:COMPUTERNAME
Expand Down
11 changes: 8 additions & 3 deletions tests/Integration/DSC_SqlRS.config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ else
$mockLastDrive = ((Get-Volume).DriveLetter | Sort-Object | Select-Object -Last 1)
$mockIsoMediaDriveLetter = [char](([int][char]$mockLastDrive) + 1)

if ($script:sqlVersion -eq '150')
if ($script:sqlVersion -eq '160')
{
# SQL2022
$instanceName = 'SSRS'
}
elseif ($script:sqlVersion -eq '150')
{
# SQL2019
$instanceName = 'SSRS'
Expand Down Expand Up @@ -139,7 +144,7 @@ Configuration DSC_SqlRS_CreateDependencies_Config
DSC_SqlRSSetup.Integration.Tests.ps1 will have installed SSRS 2017 or 2019.
We just need to start SSRS.
#>
elseif ($script:sqlVersion -in @('140', '150'))
elseif ($script:sqlVersion -in @('140', '150', '160'))
{
Service 'StartReportingServicesInstance'
{
Expand Down Expand Up @@ -260,7 +265,7 @@ Configuration DSC_SqlRS_StopReportingServicesInstance_Config
State = 'Stopped'
}
}
elseif ($script:sqlVersion -in @('150','140'))
elseif ($script:sqlVersion -in @('140', '150', '160'))
{
Service 'StopReportingServicesInstance'
{
Expand Down
17 changes: 16 additions & 1 deletion tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ BeforeAll {
$script:mockSourceMediaUrl = 'https://download.microsoft.com/download/1/a/a/1aaa9177-3578-4931-b8f3-373b24f63342/SQLServerReportingServices.exe'
}

if (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2022')
{
<#
The version below is what the MS download page said, but the .exe is
reporting 15.0.7842.32355 when used in the integration test.
#>
$script:mockSourceMediaDisplayName = 'Microsoft SQL Server 2022 Reporting Services (16.0.1113.11 - 11/23/2022)'
$script:mockSourceMediaUrl = 'https://download.microsoft.com/download/8/3/2/832616ff-af64-42b5-a0b1-5eb07f71dec9/SQLServerReportingServices.exe'
}

Write-Verbose -Message ('Start downloading the {1} executable at {0}.' -f (Get-Date -Format 'yyyy-MM-dd hh:mm:ss'), $script:mockSourceMediaDisplayName) -Verbose

Invoke-WebRequest -Uri $script:mockSourceMediaUrl -OutFile $ConfigurationData.AllNodes.SourcePath
Expand Down Expand Up @@ -92,7 +102,7 @@ AfterAll {
Older versions of Reporting Services (eg. 2016) are integration tested in
separate tests (part of resource SqlSetup).
#>
Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2017', 'Integration_SQL2019') {
Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
BeforeAll {
$resourceId = "[$($script:dscResourceFriendlyName)]Integration_Test"
}
Expand Down Expand Up @@ -157,6 +167,11 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2017',
{
$resourceCurrentState.CurrentVersion | Should -BeGreaterThan ([System.Version] '15.0.0.0')
}

if (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2022')
{
$resourceCurrentState.CurrentVersion | Should -BeGreaterThan ([System.Version] '16.0.0.0')
}
}

It 'Should return $true when Test-DscConfiguration is run' {
Expand Down

0 comments on commit 8dde54d

Please sign in to comment.