Skip to content

Commit dfd8a46

Browse files
committed
Fix integ test
1 parent 47a191f commit dfd8a46

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ stages:
256256
# Group 1
257257
'tests/Integration/Commands/Install-SqlDscServer.Integration.Tests.ps1'
258258
'tests/Integration/Commands/Install-SqlDscReportingService.Integration.Tests.ps1'
259+
'tests/Integration/Commands/Install-SqlDscBIReportServer.Integration.Tests.ps1'
259260
'tests/Integration/Commands/Connect-SqlDscDatabaseEngine.Integration.Tests.ps1'
260261
# Group 9
261262
'tests/Integration/Commands/Uninstall-SqlDscServer.Integration.Tests.ps1'
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')]
2+
param ()
3+
4+
BeforeDiscovery {
5+
try
6+
{
7+
if (-not (Get-Module -Name 'DscResource.Test'))
8+
{
9+
# Assumes dependencies has been resolved, so if this module is not available, run 'noop' task.
10+
if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable))
11+
{
12+
# Redirect all streams to $null, except the error stream (stream 2)
13+
& "$PSScriptRoot/../../build.ps1" -Tasks 'noop' 2>&1 4>&1 5>&1 6>&1 > $null
14+
}
15+
16+
# If the dependencies has not been resolved, this will throw an error.
17+
Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop'
18+
}
19+
}
20+
catch [System.IO.FileNotFoundException]
21+
{
22+
throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.'
23+
}
24+
}
25+
26+
Describe 'Install-SqlDscBIReportServer' -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
27+
BeforeAll {
28+
Write-Verbose -Message ('Running integration test as user ''{0}''.' -f $env:UserName) -Verbose
29+
30+
$script:temporaryFolder = Get-TemporaryFolder
31+
32+
# Get the path to the Power BI Report Server executable
33+
$powerBIReportServerExecutable = Join-Path -Path $script:temporaryFolder -ChildPath 'PowerBIReportServer.exe'
34+
}
35+
36+
Context 'When installing Power BI Report Server' {
37+
It 'Should run the command without throwing' {
38+
{
39+
# Set splatting parameters for Install-SqlDscBIReportServer
40+
$installSqlDscBIReportServerParameters = @{
41+
AcceptLicensingTerms = $true
42+
MediaPath = $powerBIReportServerExecutable
43+
Edition = 'Evaluation'
44+
LogPath = Join-Path -Path $script:temporaryFolder -ChildPath 'PowerBIReportServer_Install.log'
45+
SuppressRestart = $true
46+
Verbose = $true
47+
Force = $true
48+
}
49+
50+
Install-SqlDscBIReportServer @installSqlDscBIReportServerParameters
51+
} | Should -Not -Throw
52+
}
53+
54+
It 'Should have installed Power BI Report Server' {
55+
# Validate the Power BI Report Server installation
56+
$reportServerService = Get-Service -Name 'PBIReportServer'
57+
58+
$reportServerService | Should -Not -BeNullOrEmpty
59+
$reportServerService.Status | Should -Be 'Running'
60+
}
61+
62+
It 'Should stop the Power BI Report Server service' {
63+
# Stop the Power BI Report Server service to save memory on the build worker
64+
$stopServiceResult = Stop-Service -Name 'PBIReportServer' -Force -PassThru -Verbose -ErrorAction 'Stop'
65+
66+
write-verbose -Message ($stopServiceResult | Out-String) -Verbose
67+
68+
$stopServiceResult.Status | Should -Be 'Stopped'
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)