forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEnable-SqlDscRsSecureConnection.Integration.Tests.ps1
More file actions
82 lines (70 loc) · 3.7 KB
/
Enable-SqlDscRsSecureConnection.Integration.Tests.ps1
File metadata and controls
82 lines (70 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')]
param ()
BeforeDiscovery {
try
{
if (-not (Get-Module -Name 'DscResource.Test'))
{
# Assumes dependencies have been resolved, so if this module is not available, run 'noop' task.
if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable))
{
# Redirect all streams to $null, except the error stream (stream 2)
& "$PSScriptRoot/../../../build.ps1" -Tasks 'noop' 3>&1 4>&1 5>&1 6>&1 > $null
}
# If the dependencies have not been resolved, this will throw an error.
Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop'
}
}
catch [System.IO.FileNotFoundException]
{
throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.'
}
}
BeforeAll {
$script:moduleName = 'SqlServerDsc'
# Do not use -Force. Doing so, or unloading the module in AfterAll, causes
# PowerShell class types to get new identities, breaking type comparisons.
Import-Module -Name $script:moduleName -ErrorAction 'Stop'
}
Describe 'Enable-SqlDscRsSecureConnection' {
Context 'When enabling secure connection for SQL Server Reporting Services' -Tag @('Integration_SQL2017_RS') {
It 'Should enable secure connection using pipeline' {
# Enable secure connection
$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$config | Enable-SqlDscRsSecureConnection -Force
# Verify secure connection is enabled (level 1 or higher means enabled)
$verifyConfig = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$verifyConfig.SecureConnectionLevel | Should -BeGreaterOrEqual 1
}
}
Context 'When enabling secure connection for SQL Server Reporting Services' -Tag @('Integration_SQL2019_RS') {
It 'Should enable secure connection using pipeline' {
# Enable secure connection
$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$config | Enable-SqlDscRsSecureConnection -Force
# Verify secure connection is enabled (level 1 or higher means enabled)
$verifyConfig = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$verifyConfig.SecureConnectionLevel | Should -BeGreaterOrEqual 1
}
}
Context 'When enabling secure connection for SQL Server Reporting Services' -Tag @('Integration_SQL2022_RS') {
It 'Should enable secure connection using pipeline' {
# Enable secure connection
$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$config | Enable-SqlDscRsSecureConnection -Force
# Verify secure connection is enabled (level 1 or higher means enabled)
$verifyConfig = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$verifyConfig.SecureConnectionLevel | Should -BeGreaterOrEqual 1
}
}
Context 'When enabling secure connection for Power BI Report Server' -Tag @('Integration_PowerBI') {
It 'Should enable secure connection for PBIRS using pipeline' {
# Enable secure connection
$config = Get-SqlDscRSConfiguration -InstanceName 'PBIRS'
$config | Enable-SqlDscRsSecureConnection -Force
# Verify secure connection is enabled (level 1 or higher means enabled)
$verifyConfig = Get-SqlDscRSConfiguration -InstanceName 'PBIRS'
$verifyConfig.SecureConnectionLevel | Should -BeGreaterOrEqual 1
}
}
}