Skip to content

Commit

Permalink
Changes to SqlRS
Browse files Browse the repository at this point in the history
- Updated the integration tests to stop the Reporting Services service after
  the integration test. This is to save memory on the AppVeyor build worker.
  • Loading branch information
johlju committed Apr 21, 2018
1 parent ec23526 commit 920846e
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 11 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
in the build worker environment.
- Minor code cleanup in integration test, fixed the scope on variable.
- Changes to SqlSetup
- Updated the integration tests to stop the services after each integration test.
- Updated the integration tests to stop some services after each integration test.
This is to save memory on the AppVeyor build worker.
- Updated the integration tests to use a SQL Server 2016 Service Pack 1.
- Changes to SqlRS
- Updated the integration tests to stop the Reporting Services service after
the integration test. This is to save memory on the AppVeyor build worker.

## 11.1.0.0

Expand Down
77 changes: 73 additions & 4 deletions Tests/Integration/MSFT_SqlRS.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $TestEnvironment = Initialize-TestEnvironment `
-DSCResourceName $script:DSCResourceName `
-TestType Integration

$script:integrationErrorMessagePrefix = 'INTEGRATION ERROR MESSAGE:'
#endregion

$mockSqlInstallAccountPassword = ConvertTo-SecureString -String 'P@ssw0rd1' -AsPlainText -Force
Expand Down Expand Up @@ -71,7 +72,15 @@ try
ErrorAction = 'Stop'
}

Start-DscConfiguration @startDscConfigurationParameters
try
{
Start-DscConfiguration @startDscConfigurationParameters
}
catch
{
Write-Verbose -Message ('{0} {1}' -f $integrationErrorMessagePrefix, $_) -Verbose
throw $_
}
} | Should -Not -Throw
}
}
Expand Down Expand Up @@ -99,7 +108,15 @@ try
ErrorAction = 'Stop'
}

Start-DscConfiguration @startDscConfigurationParameters
try
{
Start-DscConfiguration @startDscConfigurationParameters
}
catch
{
Write-Verbose -Message ('{0} {1}' -f $integrationErrorMessagePrefix, $_) -Verbose
throw $_
}
} | Should -Not -Throw
}

Expand Down Expand Up @@ -191,7 +208,15 @@ try
ErrorAction = 'Stop'
}

Start-DscConfiguration @startDscConfigurationParameters
try
{
Start-DscConfiguration @startDscConfigurationParameters
}
catch
{
Write-Verbose -Message ('{0} {1}' -f $integrationErrorMessagePrefix, $_) -Verbose
throw $_
}
} | Should -Not -Throw
}

Expand Down Expand Up @@ -247,7 +272,15 @@ try
ErrorAction = 'Stop'
}

Start-DscConfiguration @startDscConfigurationParameters
try
{
Start-DscConfiguration @startDscConfigurationParameters
}
catch
{
Write-Verbose -Message ('{0} {1}' -f $integrationErrorMessagePrefix, $_) -Verbose
throw $_
}
} | Should -Not -Throw
}

Expand Down Expand Up @@ -289,6 +322,42 @@ try
$webRequestStatusCode | Should -BeExactly 200
}
}

$configurationName = "$($script:DSCResourceName)_StopReportingServicesInstance_Config"

Context ('When using configuration {0}' -f $configurationName) {
It 'Should compile and apply the MOF without throwing' {
{
$configurationParameters = @{
OutputPath = $TestDrive
# The variable $ConfigurationData was dot-sourced above.
ConfigurationData = $ConfigurationData
}

& $configurationName @configurationParameters

$startDscConfigurationParameters = @{
Path = $TestDrive
ComputerName = 'localhost'
Wait = $true
Verbose = $true
Force = $true
ErrorAction = 'Stop'
}

try
{
Start-DscConfiguration @startDscConfigurationParameters
}
catch
{
Write-Verbose -Message ('{0} {1}' -f $integrationErrorMessagePrefix, $_) -Verbose
throw $_
}
} | Should -Not -Throw
}
}

}
}
finally
Expand Down
14 changes: 14 additions & 0 deletions Tests/Integration/MSFT_SqlRS.config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ Configuration MSFT_SqlRS_InstallReportingServices_RestoreToNoSsl_Config
}
}
}

Configuration MSFT_SqlRS_StopReportingServicesInstance_Config
{
Import-DscResource -ModuleName 'PSDscResources'

node localhost
{
Service ('StopReportingServicesInstance{0}' -f $Node.InstanceName)
{
Name = ('ReportServer${0}' -f $Node.InstanceName)
State = 'Stopped'
}
}
}
18 changes: 12 additions & 6 deletions Tests/Integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ tests.
The integration tests will install the following instances and leave them on the
AppVeyor build worker for other integration tests to use.

Instance | Feature | AS server mode
Instance | Feature | AS server mode | State
--- | --- | ---
DSCSQL2016 | SQLENGINE,AS,CONN,BC,SDK | MULTIDIMENSIONAL
DSCTABULAR | AS,CONN,BC,SDK | TABULAR
MSSQLSERVER | SQLENGINE,CONN,BC,SDK | -
DSCSQL2016 | SQLENGINE,AS,CONN,BC,SDK | MULTIDIMENSIONAL | Running
DSCTABULAR | AS,CONN,BC,SDK | TABULAR | Stopped
MSSQLSERVER | SQLENGINE,CONN,BC,SDK | - | Stopped

All instances have a SQL Server Agent that is started.
All running Database Engine instances also have a SQL Server Agent that is started.

The instance DSCSQL2016 support mixed authentication mode.

>**Note:** Some services are stopped to save memory on the build worker. See the
>column *State*.
### Properties for all instances

- **Collation:** Finnish\_Swedish\_CI\_AS
Expand Down Expand Up @@ -90,7 +93,10 @@ AppVeyor build worker for other integration tests to use.

Instance | Feature | Description
--- | --- | ---
DSCRS2016 | RS | The Reporting Services is left initialized, and in a working state.
DSCRS2016 | RS | The Reporting Services is initialized, and in a working state.

>**Note:** The Reporting Services service is stopped to save memory on the build
>worker.
### Properties for the instance

Expand Down

0 comments on commit 920846e

Please sign in to comment.