Skip to content

fix: harden kubeletfunc - #9198

Open
Tim Wright (timmy-wright) wants to merge 1 commit into
mainfrom
timmy/kubeletfunc
Open

fix: harden kubeletfunc#9198
Tim Wright (timmy-wright) wants to merge 1 commit into
mainfrom
timmy/kubeletfunc

Conversation

@timmy-wright

Copy link
Copy Markdown
Contributor

Harden kubeletfunc

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

@github-actions

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   12 suites   34s ⏱️
392 tests 358 ✅ 0 💤 34 ❌
395 runs  361 ✅ 0 💤 34 ❌

For more details on these failures, see this check.

Results for commit 7d2e45c.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to harden the Windows CSE kubelet service setup logic (New-NSSMService) by making service installation more robust/idempotent and adding Pester coverage for the new behavior.

Changes:

  • Refactors New-NSSMService to remove existing services before install, introduce an Invoke-Nssm wrapper, and add explicit error handling around DependOnService.
  • Adds new Pester tests covering the “services exist vs do not exist” cases for New-NSSMService.
  • Minor formatting cleanup in a few functions (parameter spacing, brace formatting).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
staging/cse/windows/kubeletfunc.ps1 Refactors New-NSSMService, adds an extra dot-source, and adds stricter error handling around NSSM configuration.
staging/cse/windows/kubeletfunc.tests.ps1 Adds New-NSSMService unit tests and a stub to allow mocking Windows-only cmdlets in isolation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1 to +2
. $PSScriptRoot\helpers.ps1

Comment on lines +6 to 9
# 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 {}
}
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.

2 participants