Skip to content

Bug: test_helpers.psm1 crashes from unhandled ItemNotFoundException and Strict-Mode native errors #2414

Description

@Piyush0049

Jenkins and plugins versions report

N/A - This applies to the repository's local PowerShell test scripts.

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows (Local build/development environment)

Reproduction steps

  1. Run a test where Get-SutImage attempts to locate a Dockerfile that doesn't exist yet.
  2. Run Get-JenkinsPassword on PowerShell 7.3+ with $PSNativeCommandUseErrorActionPreference = $true while the container is still booting.

Expected Results

  1. Get-SutImage should gracefully print its intended friendly error message ("Wrong Dockerfile path format or file does not exist").
  2. Get-JenkinsPassword should silently return $null if the container isn't ready so the test suite can keep polling.

Actual Results

  1. Get-SutImage uses Resolve-Path right before the Test-Path check, which violently throws an ItemNotFoundException and crashes the script before the friendly error can ever print.
  2. Get-JenkinsPassword relies on docker exec failing silently. In PS 7.3+, a failing native command throws a terminating exception, crashing the entire test suite on modern runners.

Anything else?

No response

Are you interested in contributing a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions