Skip to content

Commit a1fa23e

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
fix tests setting trace level
1 parent c01cff6 commit a1fa23e

37 files changed

+224
-3
lines changed

dsc/tests/dsc.exist.tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# Licensed under the MIT License.
33

44
Describe '_exist tests' {
5+
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
7+
}
8+
9+
AfterAll {
10+
$env:DSC_TRACE_LEVEL = $null
11+
}
12+
513
It 'Resource supporting exist on set should receive _exist for: <exist>' -TestCases @(
614
@{ exist = $true }
715
@{ exist = $false }

dsc/tests/dsc_args.tests.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
Describe 'config argument tests' {
55
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
67
$manifest = @'
78
{
89
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
@@ -52,6 +53,7 @@ Describe 'config argument tests' {
5253

5354
AfterAll {
5455
$env:DSC_RESOURCE_PATH = $oldPath
56+
$env:DSC_TRACE_LEVEL = $null
5557
}
5658

5759
It 'input is <type>' -TestCases @(

dsc/tests/dsc_config_get.tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# Licensed under the MIT License.
33

44
Describe 'dsc config get tests' {
5+
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
7+
}
8+
9+
AfterAll {
10+
$env:DSC_TRACE_LEVEL = $null
11+
}
12+
513
It 'can successfully get config with multiple registry resource instances: <config>' -Skip:(!$IsWindows) -TestCases @(
614
@{ config = 'osinfo_registry.dsc.json' }
715
@{ config = 'osinfo_registry.dsc.yaml' }

dsc/tests/dsc_config_set.tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# Licensed under the MIT License.
33

44
Describe 'dsc config set tests' {
5+
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
7+
}
8+
9+
AfterAll {
10+
$env:DSC_TRACE_LEVEL = $null
11+
}
12+
513
It 'can use _exist with resources that support and do not support it' {
614
$config_yaml = @"
715
`$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json

dsc/tests/dsc_config_test.tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# Licensed under the MIT License.
33

44
Describe 'dsc config test tests' {
5+
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
7+
}
8+
9+
AfterAll {
10+
$env:DSC_TRACE_LEVEL = $null
11+
}
12+
513
It 'Assertion works correctly' {
614
$configYaml = @'
715
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json

dsc/tests/dsc_discovery.tests.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Describe 'tests for resource discovery' {
55
BeforeAll {
66
$env:DSC_RESOURCE_PATH = $testdrive
7+
$env:DSC_TRACE_LEVEL = 'error'
78

89
$script:lookupTableFilePath = if ($IsWindows) {
910
Join-Path $env:LocalAppData "dsc\AdaptedResourcesLookupTable.json"
@@ -18,6 +19,7 @@ Describe 'tests for resource discovery' {
1819

1920
AfterAll {
2021
$env:DSC_RESOURCE_PATH = $null
22+
$env:DSC_TRACE_LEVEL = $null
2123
}
2224

2325
It 'Use DSC_RESOURCE_PATH instead of PATH when defined' {

dsc/tests/dsc_export.tests.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# Licensed under the MIT License.
33

44
Describe 'resource export tests' {
5+
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
7+
}
8+
9+
AfterAll {
10+
$env:DSC_TRACE_LEVEL = $null
11+
}
512

613
It 'Export can be called on individual resource' {
714

dsc/tests/dsc_expressions.tests.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# Licensed under the MIT License.
33

44
Describe 'Expressions tests' {
5+
6+
BeforeAll {
7+
$env:DSC_TRACE_LEVEL = 'error'
8+
}
9+
10+
AfterAll {
11+
$env:DSC_TRACE_LEVEL = $null
12+
}
13+
514
It 'Accessors work: <text>' -TestCases @(
615
@{ text = "[parameters('test').hello]"; expected = '@{world=there}' }
716
@{ text = "[parameters('test').hello.world]"; expected = 'there' }

dsc/tests/dsc_extension_discover.tests.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ Describe 'Discover extension tests' {
1414
$oldPath = $env:PATH
1515
$toolPath = Resolve-Path -Path "$PSScriptRoot/../../extensions/test/discover"
1616
$env:PATH = "$toolPath" + [System.IO.Path]::PathSeparator + $oldPath
17+
$env:DSC_TRACE_LEVEL = 'error'
1718
}
1819

1920
AfterAll {
2021
$env:PATH = $oldPath
22+
$env:DSC_TRACE_LEVEL = $null
2123
}
2224

2325
It 'Discover extensions' {

dsc/tests/dsc_functions.tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# Licensed under the MIT License.
33

44
Describe 'tests for function expressions' {
5+
BeforeAll {
6+
$env:DSC_TRACE_LEVEL = 'error'
7+
}
8+
9+
AfterAll {
10+
$env:DSC_TRACE_LEVEL = $null
11+
}
12+
513
It 'function works: <text>' -TestCases @(
614
@{ text = "[concat('a', 'b')]"; expected = 'ab' }
715
@{ text = "[concat('a', 'b', 'c')]"; expected = 'abc' }

0 commit comments

Comments
 (0)