Skip to content

🧪 test: add Set-SvcState error handling tests in Undo mode - #55

Merged
Ahmed-Yaseen99 merged 1 commit into
mainfrom
test/svc-state-undo-error-handling-17759227103164624893
Oct 15, 2026
Merged

Ahmed-Yaseen99 merged 1 commit into
mainfrom
test/svc-state-undo-error-handling-17759227103164624893

Conversation

@Ahmed-Yaseen99

Copy link
Copy Markdown
Member

🎯 What: Missing error handling tests for Set-SvcState in Undo mode (unslop-win11.ps1 and unslop-win10.ps1).

📊 Coverage:

  • Added test case when Set-Service throws an exception in Undo mode, validating that $global:FailCount increments and FAILED: Could not restore service... is logged.
  • Added test case when Start-Service throws an exception in Undo mode for non-Manual startup types (e.g., Automatic), validating that $global:FailCount increments and FAILED: Could not restore service... is logged.
  • Added test case verifying best-effort handling when Start-Service fails for Manual startup type (validating $global:FailCount remains 0).
  • Fixed existing debloat mode Set-SvcState error trapping test so Set-Service throws (since Stop-Service failure is caught by an inner best-effort block).
  • Added cross-platform Set-ItemProperty stubs in BeforeAll for non-Windows testing sessions.

✨ Result: Improved unit test coverage and failure honesty verification for service restoration error paths across unslop-win11.Tests.ps1 and unslop-win10.Tests.ps1.


PR created automatically by Jules for task 17759227103164624893 started by @Ahmed-Yaseen99

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Add comprehensive Pester unit tests for Set-SvcState error handling in Undo mode:
- Test error trapping when Set-Service throws an exception during restore.
- Test error trapping when Start-Service throws an exception for non-Manual startup types.
- Test best-effort error handling when Start-Service throws for Manual startup types.
- Fix existing debloat mode Set-SvcState error trapping test so Set-Service is mocked to throw.
- Add cross-platform Set-ItemProperty stubs in BeforeAll for non-Windows testing.
@Ahmed-Yaseen99
Ahmed-Yaseen99 force-pushed the test/svc-state-undo-error-handling-17759227103164624893 branch from f737517 to cabbbb5 Compare October 15, 2026 20:50
@Ahmed-Yaseen99
Ahmed-Yaseen99 merged commit 7c3d511 into main Oct 15, 2026
4 checks passed
@Ahmed-Yaseen99
Ahmed-Yaseen99 deleted the test/svc-state-undo-error-handling-17759227103164624893 branch October 15, 2026 20:51
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