Skip to content

Fix broken Invoke-PesterTests runner#1663

Open
bcullman wants to merge 6 commits intoOctopusDeploy:masterfrom
bcullman:fix-broken-test-runner
Open

Fix broken Invoke-PesterTests runner#1663
bcullman wants to merge 6 commits intoOctopusDeploy:masterfrom
bcullman:fix-broken-test-runner

Conversation

@bcullman
Copy link
Contributor

Background

After submitting and completing #1658, I realized I should have at least attempted to add tests around that change.

When I sat down to do that, I noticed there are actually two Invoke-PesterTests.ps1 scripts in this repo, and they did not behave consistently:

  • the StepTemplatePacker runner was broken
  • the step-templates runner had separate runner logic and different Pester resolution behavior

This PR cleans that up so that both test runners execute successfully again.

The intent here is to fix the runners themselves, not to change the behavior of the underlying test suites. The tests still pass (or fail) as they did before on master once the runners are able to start correctly.

Results

This PR:

  • introduces a shared Pester runner used by both existing Invoke-PesterTests.ps1 entrypoints
  • preserves each suite's previous Pester-version preference instead of forcing a single version everywhere
  • fixes the broken StepTemplatePacker runner import/path behavior
  • keeps the existing step-templates unpack-before-test behavior
  • adds an optional file filter so either runner can execute a subset of tests
  • includes a few path and JSON assertion updates so the runners also work correctly under pwsh on non-Windows environments

Before

  • only one of the two Invoke-PesterTests.ps1 scripts was reliably runnable
  • tools/StepTemplatePacker/tests/Invoke-PesterTests.ps1 could fail during Pester import/path resolution
  • the two runners duplicated similar logic but resolved Pester differently
  • on non-Windows PowerShell, some test path handling and multiline JSON assertions were not portable

After

  • both Invoke-PesterTests.ps1 scripts run successfully
  • the StepTemplatePacker test runner starts and executes tests instead of failing during setup
  • the step-templates runner still reports the same underlying scheduled-task test failures that already existed on master
  • both runners share the same startup/discovery/filter logic while keeping suite-specific behavior where needed
  • the runners now also work under pwsh on macOS

Pre-requisites

  • This PR does not add or modify a step template JSON definition
  • No template Id or Version changes are required
  • No step template parameters were added or changed
  • Existing test pass/fail behavior is preserved; this PR fixes runner behavior only

@github-actions
Copy link

Start Hyponome locally

docker pull ghcr.io/hnrkndrssn/hyponome:main
docker run --rm -p 8000:8080 -it ghcr.io/hnrkndrssn/hyponome:main

Review in Hyponome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant