chore: add windows CSE helpers file - #9194
Conversation
Windows Unit Test Results 3 files 13 suites 53s ⏱️ Results for commit a383e2d. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
This PR adds a shared helpers.ps1 module for the Windows CSE scripts package and wires it into the staged CSE function scripts so common routines can be reused across files. It also adds initial Pester coverage for the helpers and updates the Windows CSE README with example local test commands.
Changes:
- Add
staging/cse/windows/helpers.ps1(common helper functions) and dot-source it fromall.ps1and several CSE function script files. - Add
helpers.tests.ps1with Pester tests forRemove-ServiceIfExists. - Update
staging/cse/windows/READMEwith exampleInvoke-Pestercommands.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| staging/cse/windows/helpers.ps1 | New shared helper functions for Windows CSE scripts. |
| staging/cse/windows/helpers.tests.ps1 | New Pester tests validating Remove-ServiceIfExists behavior. |
| staging/cse/windows/all.ps1 | Dot-sources helpers.ps1 before the other function scripts. |
| staging/cse/windows/configfunc.ps1 | Dot-sources helpers.ps1 to make shared helpers available. |
| staging/cse/windows/containerdfunc.ps1 | Dot-sources helpers.ps1 to make shared helpers available. |
| staging/cse/windows/kubeletfunc.ps1 | Dot-sources helpers.ps1 to make shared helpers available. |
| staging/cse/windows/windowsciliumnetworkingfunc.ps1 | Dot-sources helpers.ps1 and fixes minor whitespace in hashtable. |
| staging/cse/windows/README | Adds example local commands for running the Pester test suites. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
c37af21 to
e86ad80
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
staging/cse/windows/helpers.tests.ps1:7
- helpers.tests.ps1 stubs Get-Service for non-Windows test runs, but sc.exe is also Windows-only and is mocked later. To keep the stated goal of running these tests in isolation on non-Windows, add a no-op sc.exe function stub so Pester can reliably Mock it even when the native binary isn't present.
# Get-Service is a Windows-only cmdlet; stub it so Mock can override it when
# tests run in isolation (e.g. locally on non-Windows, outside the full suite).
function Get-Service {}
- Stub sc.exe alongside Get-Service so tests can Mock it in isolation off-Windows. - Extract the path-qualified nssm.exe call into a mockable Invoke-NssmExe wrapper (Pester can't intercept path-qualified invocations) and add success/failure tests for Invoke-Nssm. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add and wire up windows CSE helpers file
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #