Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Nov 26, 2022
1 parent b7dba14 commit 32785ac
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
1 change: 1 addition & 0 deletions source/DSCResources/DSC_SqlDatabase/DSC_SqlDatabase.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ $script:supportedCompatibilityLevels = @{
13 = @('Version100', 'Version110', 'Version120', 'Version130')
14 = @('Version100', 'Version110', 'Version120', 'Version130', 'Version140')
15 = @('Version100', 'Version110', 'Version120', 'Version130', 'Version140', 'Version150')
16 = @('Version100', 'Version110', 'Version120', 'Version130', 'Version140', 'Version150', 'Version160')
}

<#
Expand Down
21 changes: 0 additions & 21 deletions tests/Integration/DSC_SqlDatabase.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,12 @@ BeforeAll {
-ResourceType 'Mof' `
-TestType 'Integration'

Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1')

if (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2022')
{
$script:sqlVersion = '160'
}
elseif (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2019')
{
$script:sqlVersion = '150'
}
elseif (Test-ContinuousIntegrationTaskCategory -Category 'Integration_SQL2017')
{
$script:sqlVersion = '140'
}
else
{
$script:sqlVersion = '130'
}

$configFile = Join-Path -Path $PSScriptRoot -ChildPath "$($script:dscResourceName).config.ps1"
. $configFile
}

AfterAll {
Restore-TestEnvironment -TestEnvironment $script:testEnvironment

Get-Module -Name 'CommonTestHelper' -All | Remove-Module -Force
}

Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
Expand Down
37 changes: 1 addition & 36 deletions tests/Integration/DSC_SqlDatabase.config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,6 @@ if (Test-Path -Path $configFile)
}
else
{
<#
The variable $script:sqlVersion is set in the integration script file,
which is available once this script is dot-sourced.
#>
switch ($script:sqlVersion)
{
'160'
{
$versionSpecificData = @{
CompatibilityLevel = 'Version150'
}
}

'150'
{
$versionSpecificData = @{
CompatibilityLevel = 'Version120'
}
}

'140'
{
$versionSpecificData = @{
CompatibilityLevel = 'Version120'
}
}

'130'
{
$versionSpecificData = @{
CompatibilityLevel = 'Version120'
}
}
}

$ConfigurationData = @{
AllNodes = @(
@{
Expand All @@ -67,7 +32,7 @@ else
DatabaseName5 = 'Database5'

Collation = 'SQL_Latin1_General_Pref_CP850_CI_AS'
CompatibilityLevel = $versionSpecificData.CompatibilityLevel
CompatibilityLevel = 'Version120'
RecoveryModel = 'Simple'
OwnerName = 'sa'
}
Expand Down

0 comments on commit 32785ac

Please sign in to comment.