File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 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
1717 }
1818 AfterAll {
1919 $env: PSModulePath = $OldPSModulePath
20+
21+ # Remove after all the tests are done
22+ Remove-Module $script :winPSModule - Force - ErrorAction Ignore
2023 }
2124
2225 BeforeEach {
@@ -214,18 +217,14 @@ resources:
214217 }
215218
216219 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
219222 Import-Module $winPSModule - Force - ErrorAction Stop
220223
221224 # Mock the command to work on GitHub runners because Microsoft.PowerShell.Security is not available
222225 Mock - CommandName ConvertTo-SecureString - MockWith { [System.Security.SecureString ]::new() }
223226 }
224227
225- AfterAll {
226- Remove-Module $script :winPSModule - Force - ErrorAction Ignore
227- }
228-
229228 $jsonInput = @ {
230229 resources = @ {
231230 name = ' Service info'
@@ -243,7 +242,7 @@ resources:
243242 # Instead of calling dsc.exe we call the cmdlet directly to be able to test the output and mocks
244243 $resourceObject = Get-DscResourceObject - jsonInput $jsonInput
245244 $cacheEntry = Invoke-DscCacheRefresh - Module PSDesiredStateConfiguration
246-
245+
247246 $out = Invoke-DscOperation - Operation Test - DesiredState $resourceObject - dscResourceCache $cacheEntry
248247 $LASTEXITCODE | Should - Be 0
249248 $out.properties.InDesiredState.InDesiredState | Should - Be $false
You can’t perform that action at this time.
0 commit comments