File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ Describe 'WindowsPowerShell adapter resource tests - requires elevated permissio
17
17
}
18
18
AfterAll {
19
19
$env: PSModulePath = $OldPSModulePath
20
+
21
+ # Remove after all the tests are done
22
+ Remove-Module $script :winPSModule - Force - ErrorAction Ignore
20
23
}
21
24
22
25
BeforeEach {
@@ -214,18 +217,14 @@ resources:
214
217
}
215
218
216
219
It ' Config works with credential object' - Skip:(! $IsWindows ) {
217
- BeforeAll {
218
- $script :winPSModule = Resolve-Path - Path (Join-Path $PSScriptRoot ' ..' ' powershell-adapter ' ' psDscAdapter' ' win_psDscAdapter.psm1' ) | Select-Object - ExpandProperty Path
220
+ BeforeDiscovery {
221
+ $script :winPSModule = Resolve-Path - Path (Join-Path $PSScriptRoot ' ..' ' psDscAdapter' ' win_psDscAdapter.psm1' ) | Select-Object - ExpandProperty Path
219
222
Import-Module $winPSModule - Force - ErrorAction Stop
220
223
221
224
# Mock the command to work on GitHub runners because Microsoft.PowerShell.Security is not available
222
225
Mock - CommandName ConvertTo-SecureString - MockWith { [System.Security.SecureString ]::new() }
223
226
}
224
227
225
- AfterAll {
226
- Remove-Module $script :winPSModule - Force - ErrorAction Ignore
227
- }
228
-
229
228
$jsonInput = @ {
230
229
resources = @ {
231
230
name = ' Service info'
@@ -243,7 +242,7 @@ resources:
243
242
# Instead of calling dsc.exe we call the cmdlet directly to be able to test the output and mocks
244
243
$resourceObject = Get-DscResourceObject - jsonInput $jsonInput
245
244
$cacheEntry = Invoke-DscCacheRefresh - Module PSDesiredStateConfiguration
246
-
245
+
247
246
$out = Invoke-DscOperation - Operation Test - DesiredState $resourceObject - dscResourceCache $cacheEntry
248
247
$LASTEXITCODE | Should - Be 0
249
248
$out.properties.InDesiredState.InDesiredState | Should - Be $false
You can’t perform that action at this time.
0 commit comments