SecretManagement icon indicating copy to clipboard operation
SecretManagement copied to clipboard

Register-SecretVault locks up in Pester if a [IO.Path] object is passed as a vaultparameter

Open JustinGrote opened this issue 4 years ago • 2 comments

Test Snippet

Describe 'CSV Vault Demo' {
    BeforeAll {
        #First Import our Module
        $moduleRoot = Resolve-Path $PSScriptRoot/../Source
        $moduleManifest = Resolve-Path $moduleRoot/SecretManagement.CSV.psd1
        $mocks = Resolve-Path $PSScriptRoot/Mocks
        $SingleEntryCSVPath = Resolve-Path $Mocks/SingleEntry.csv
        Import-Module $ModuleManifest -force

        Register-SecretVault -Name 'PESTER-SingleEntry' -ModuleName $moduleManifest -VaultParameters @{
            Path=$SingleEntryCSVPath
        }

Expected

Will register as expected

Actual

Completely hangs uncancellable, requires restart

Workaround

If you explicity make $SingleEntryCSVPath a [String]$SingleEntryCSVPath, it works fine. If you run the command directly on the terminal it seems to work fine, only happens when I run it as a pester test strangely.

JustinGrote avatar Apr 15 '21 23:04 JustinGrote

What version of Pester are you running? I run Register-SecretVault in my Pester tests and have not seen any problems. At this point it is unknown if the hang is in SecretManagement, the extension vault, or Pester. You should attach a debugger to find out where the hang is.

PaulHigin avatar Apr 21 '21 16:04 PaulHigin

@PaulHigin 5.1.1, I'll try to collect more detail I just wanted to get this info out there when I ran into it, since you weren't able to reproduce it may just be me.

JustinGrote avatar Apr 21 '21 16:04 JustinGrote