-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1247 from PowerShell/dev
Release of version 12.1.0.0 of SqlServerDsc
- Loading branch information
Showing
63 changed files
with
3,044 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
DSCResource.Tests | ||
DscResource.Tests | ||
DSCResource.Tests | ||
.vs | ||
.vscode | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@{ | ||
<# | ||
For the custom rules to work, the DscResource.Tests repo must be | ||
cloned. It is automatically clone as soon as any unit or | ||
integration tests are run. | ||
#> | ||
CustomRulePath = '.\DSCResource.Tests\DscResource.AnalyzerRules' | ||
|
||
IncludeRules = @( | ||
# DSC Resource Kit style guideline rules. | ||
'PSAvoidDefaultValueForMandatoryParameter', | ||
'PSAvoidDefaultValueSwitchParameter', | ||
'PSAvoidInvokingEmptyMembers', | ||
'PSAvoidNullOrEmptyHelpMessageAttribute', | ||
'PSAvoidUsingCmdletAliases', | ||
'PSAvoidUsingComputerNameHardcoded', | ||
'PSAvoidUsingDeprecatedManifestFields', | ||
'PSAvoidUsingEmptyCatchBlock', | ||
'PSAvoidUsingInvokeExpression', | ||
'PSAvoidUsingPositionalParameters', | ||
'PSAvoidShouldContinueWithoutForce', | ||
'PSAvoidUsingWMICmdlet', | ||
'PSAvoidUsingWriteHost', | ||
'PSDSCReturnCorrectTypesForDSCFunctions', | ||
'PSDSCStandardDSCFunctionsInResource', | ||
'PSDSCUseIdenticalMandatoryParametersForDSC', | ||
'PSDSCUseIdenticalParametersForDSC', | ||
'PSMisleadingBacktick', | ||
'PSMissingModuleManifestField', | ||
'PSPossibleIncorrectComparisonWithNull', | ||
'PSProvideCommentHelp', | ||
'PSReservedCmdletChar', | ||
'PSReservedParams', | ||
'PSUseApprovedVerbs', | ||
'PSUseCmdletCorrectly', | ||
'PSUseOutputTypeCorrectly', | ||
'PSAvoidGlobalVars', | ||
'PSAvoidUsingConvertToSecureStringWithPlainText', | ||
'PSAvoidUsingPlainTextForPassword', | ||
'PSAvoidUsingUsernameAndPasswordParams', | ||
'PSDSCUseVerboseMessageInDSCResource', | ||
'PSShouldProcess', | ||
'PSUseDeclaredVarsMoreThanAssignments', | ||
'PSUsePSCredentialType', | ||
|
||
<# | ||
This is to test all the DSC Resource Kit custom rules. | ||
The name of the function-blocks of each custom rule start | ||
with 'Measure*'. | ||
#> | ||
'Measure-*' | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<# | ||
.SYNOPSIS | ||
Assert that the test environment is properly setup and loaded into the | ||
PowerShell session. | ||
.DESCRIPTION | ||
Assert that the test environment is properly setup and loaded into the | ||
PowerShell session. | ||
.EXAMPLE | ||
.\Assert-testEnvironment.ps1 | ||
Will assert that the current PowerShell session is ready to run tests. | ||
#> | ||
|
||
[CmdletBinding(SupportsShouldProcess = $true)] | ||
param | ||
( | ||
) | ||
|
||
#region Verify prerequisites Pester | ||
$pesterModuleName = 'Pester' | ||
|
||
# This is the minimum version that can be used with the tests in this repo. | ||
$pesterModuleMinimumVersion = '4.0.2' | ||
|
||
<# | ||
Pester v4.4.0 has a fix for '-Not -Throw' so it shows the actual error | ||
message if an unexpected exception does occur. It will help when debugging | ||
tests. | ||
If no Pester module exist, then use this as the minimum version. | ||
#> | ||
$pesterModuleRecommendedMinimumVersion = '4.4.0' | ||
|
||
$pesterModule = Get-Module $pesterModuleName -ListAvailable -Verbose:$false | | ||
Where-Object -Property 'Version' -GE -Value $pesterModuleMinimumVersion | | ||
Sort-Object -Property 'Version' -Descending | | ||
Select-Object -First 1 | ||
|
||
if (-not $pesterModule) | ||
{ | ||
<# | ||
Not installing the module here because it's not known what scope the | ||
user want (can) to install the module in. | ||
#> | ||
$message = 'Missing a compatible version of the {0} module. Minimum version of {0} module can be ''{2}'', but the recommended minimum version is ''{1}''.' -f $pesterModuleName, $pesterModuleRecommendedMinimumVersion, $pesterModuleMinimumVersion | ||
Write-Warning -Message $message | ||
$dependencyMissing = $true | ||
} | ||
else | ||
{ | ||
Write-Verbose -Message ('A compatible {0} module is already installed (v{1}). If you want to use a newer version of {0} module, please install it manually.' -f $pesterModule.Name, $pesterModule.Version) | ||
} | ||
#endregion Verify prerequisites Pester | ||
|
||
#region Verify prerequisites PSDepend | ||
$psDependModuleName = 'PSDepend' | ||
|
||
# This is the minimum version that can be used with the tests in this repo. | ||
$psDependModuleMinimumVersion = '0.3.0' | ||
$psDependModuleRecommendedMinimumVersion = 'latest' | ||
|
||
$psDependModule = Get-Module $psDependModuleName -ListAvailable -Verbose:$false | | ||
Where-Object -Property 'Version' -GE -Value $psDependModuleMinimumVersion | | ||
Sort-Object -Property 'Version' -Descending | | ||
Select-Object -First 1 | ||
|
||
if (-not $psDependModule) | ||
{ | ||
<# | ||
Not installing the module here because it's not known what scope the | ||
user want (can) to install the module in. | ||
#> | ||
$message = 'Missing a compatible version of the {0} module. Minimum version of {0} module can be ''{2}'', but the recommended minimum version is ''{1}''. Please install {0} module manually, then run this script again.' -f $psDependModuleName, $psDependModuleRecommendedMinimumVersion, $psDependModuleMinimumVersion | ||
Write-Warning -Message $message | ||
$dependencyMissing = $true | ||
} | ||
else | ||
{ | ||
Write-Verbose -Message ('A compatible {0} module is already installed (v{1}). If you want to use a newer version of {0} module, please install it manually.' -f $psDependModule.Name, $psDependModule.Version) | ||
} | ||
#endregion Verify prerequisites PSDepend | ||
|
||
if ($dependencyMissing) | ||
{ | ||
Write-Output -InputObject 'Please install the necessary dependencies manually, then run this script again.' | ||
return | ||
} | ||
|
||
$dependenciesPath = Join-Path $PSScriptRoot -ChildPath 'Tests' | ||
|
||
Write-Verbose -Message ('Running Invoke-PSDepend using dependencies found under the path ''{0}''.' -f $dependenciesPath) | ||
|
||
if ($PSBoundParameters.ContainsKey('Confirm')) | ||
{ | ||
$invokePSDependConfirmation = $ConfirmPreference | ||
} | ||
else | ||
{ | ||
$invokePSDependConfirmation = $false | ||
} | ||
|
||
Invoke-PSDepend -Path $dependenciesPath -Confirm:$invokePSDependConfirmation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.