PowerShell / SecretManagement

PowerShell module to consistent usage of secrets through different extension vaults
MIT License
317 stars 46 forks source link

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

Open JustinGrote opened 3 years ago

JustinGrote commented 3 years ago

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.

PaulHigin commented 3 years ago

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.

JustinGrote commented 3 years ago

@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.