forked from instruct-br/puppet-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpuppet-agent-installer.tests.ps1
48 lines (38 loc) · 1.39 KB
/
puppet-agent-installer.tests.ps1
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
Describe 'Testing against PSSA rules' {
Context 'PSSA Standard Rules' {
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
$analysis = Invoke-ScriptAnalyzer -Path 'puppet-agent-installer.ps1'
forEach ($rule in $scriptAnalyzerRules) {
It "Should pass $rule" {
If ($analysis.RuleName -contains $rule) {
$analysis | Where RuleName -EQ $rule -outvariable failures | Out-Default
$failures.Count | Should Be 0
}
}
}
}
Context 'PSSA CodeFormatting Rules' {
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
$analysis = Invoke-ScriptAnalyzer -Settings puppet-agent-installer.codeformating.psd1 -Path 'puppet-agent-installer.ps1'
forEach ($rule in $scriptAnalyzerRules) {
It "Should pass $rule" {
If ($analysis.RuleName -contains $rule) {
$analysis | Where RuleName -EQ $rule -outvariable failures | Out-Default
$failures.Count | Should Be 0
}
}
}
}
Context 'PSSA Data File CodeFormatting ' {
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
$analysis = Invoke-ScriptAnalyzer -Settings puppet-agent-installer.codeformating.psd1 -Path 'puppet-agent-installer.codeformating.psd1'
forEach ($rule in $scriptAnalyzerRules) {
It "Should pass $rule" {
If ($analysis.RuleName -contains $rule) {
$analysis | Where RuleName -EQ $rule -outvariable failures | Out-Default
$failures.Count | Should Be 0
}
}
}
}
}