Skip to content

Add Windows Go tests to CI#43365

Open
getvictor wants to merge 37 commits intomainfrom
test-go-windows
Open

Add Windows Go tests to CI#43365
getvictor wants to merge 37 commits intomainfrom
test-go-windows

Conversation

@getvictor
Copy link
Copy Markdown
Member

@getvictor getvictor commented Apr 9, 2026

Resolves #40809

Added a few basic tests.
Fixed a small race condition. Manually tested orbit on Windows with the fix.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed a race during BitLocker worker shutdown on Windows to prevent hangs or unexpected failures.
  • Tests

    • Added comprehensive Windows-only tests for BitLocker behavior and related utilities.
    • Hardened tests to use stricter assertions and deterministic checks.
  • Chores

    • Added an automated Windows test workflow to run scheduled and PR-triggered Windows test runs.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.88%. Comparing base (8509b18) to head (8286d10).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #43365   +/-   ##
=======================================
  Coverage   66.88%   66.88%           
=======================================
  Files        2590     2590           
  Lines      207649   207649           
  Branches     9279     9279           
=======================================
  Hits       138883   138883           
- Misses      56127    56128    +1     
+ Partials    12639    12638    -1     
Flag Coverage Δ
backend 68.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from victor/40809-bitlocker to main April 9, 2026 22:33
@getvictor
Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated Windows GitHub Actions workflow to run Orbit’s Windows-specific Go tests and extends the test suite to cover key Windows-only functionality (BitLocker COM/WMI paths and CIS audit via secedit), alongside a small COM worker shutdown race fix.

Changes:

  • Added a new GitHub Actions workflow to execute selected Windows-only Orbit Go test packages on windows-latest (plus log upload + scheduled Slack notify on failure).
  • Added/updated Windows-only tests for BitLocker management helpers and CIS audit table behavior.
  • Fixed a COM worker shutdown race by introducing a stop channel (instead of closing workCh) and cleanly signaling closure via done.

Reviewed changes

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

File Description
orbit/pkg/table/cis_audit/cis_audit_windows_test.go Tightens assertions and adds a Windows CI-oriented test that exercises a real CIS item via secedit.
orbit/pkg/bitlocker/bitlocker_worker_windows.go Reworks COM worker shutdown to avoid panics from closing a channel that another goroutine may send on.
orbit/pkg/bitlocker/bitlocker_management_windows_test.go Adds Windows-only tests for error formatting, helpers, COM worker lifecycle, and COM/WMI BitLocker status retrieval.
.github/workflows/test-go-windows.yml Introduces a new Windows CI workflow to run the relevant Orbit Windows Go test packages and publish logs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 929727ae-9be5-4fe7-95c6-7793c64bd1fe

📥 Commits

Reviewing files that changed from the base of the PR and between 2bf841f and 8286d10.

📒 Files selected for processing (2)
  • .github/workflows/test-go-windows.yml
  • orbit/pkg/bitlocker/bitlocker_management_windows_test.go
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/test-go-windows.yml
  • orbit/pkg/bitlocker/bitlocker_management_windows_test.go

Walkthrough

Adds a Windows-specific GitHub Actions workflow to run Go tests on windows-latest; introduces a Windows-only test file exercising BitLocker logic and a process-wide COM worker for tests; refactors bitlocker.COMWorker shutdown to use a stop chan struct{} and a select-based loop so Close() signals shutdown and waits for cleanup without closing workCh; and updates a Windows test file to remove a build tag and switch to require assertions.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description is minimal but references issue #40809 and mentions adding tests and fixing a race condition. However, it lacks detail on test coverage, methodology, and which specific race condition was fixed. Expand the description to clarify which race condition was fixed, what Windows tests were added, and their purpose in preventing the BitLocker encrypt/decrypt loop.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Windows Go tests to CI' directly describes the main change in the PR: adding a new GitHub Actions workflow for Windows-specific Go tests and associated test files.
Linked Issues check ✅ Passed The PR addresses the race condition in COMWorker shutdown and adds comprehensive Windows tests for BitLocker functionality, which directly support the objectives of fixing the encrypt/decrypt loop reported in issue #40809.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing issue #40809: the new CI workflow enables Windows testing, the new test file validates BitLocker behavior, the worker fix resolves a race condition, and the audit test cleanup improves test reliability.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-go-windows

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/test-go-windows.yml (1)

65-65: Unused variable $pkgList.

The variable $pkgList is assigned but never used. The go test command on line 68 uses $packages directly.

🧹 Proposed fix to remove unused variable
          $packages | ForEach-Object { Write-Host "  $_" }
-          $pkgList = $packages -join ","
-          Write-Host "Running Windows-specific Go tests for packages:"
+          Write-Host "Running Windows-specific Go tests for packages:"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test-go-windows.yml at line 65, The assignment to $pkgList
is unused; remove the unnecessary variable ($pkgList = $packages -join ",") and
update any references to use $packages directly (or, if the intent was to pass a
comma‑joined string to the go test invocation, replace usage of $packages with
$pkgList and keep the join). Locate the assignment of $pkgList and either delete
it or change the go test invocation to consume the joined string depending on
the intended behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/test-go-windows.yml:
- Around line 86-92: The summary captures only the matched substring because the
code uses .Matches.Value; change each capture to return the full matching line
by using the MatchInfo .Line property (e.g. set $failures = ($logContent |
Select-String -Pattern "^--- FAIL:" -AllMatches).Line and likewise replace
.Matches.Value with .Line for $panics and $failPkgs) so the printed summary
shows the entire test failure/panic/package lines for easier debugging.

---

Nitpick comments:
In @.github/workflows/test-go-windows.yml:
- Line 65: The assignment to $pkgList is unused; remove the unnecessary variable
($pkgList = $packages -join ",") and update any references to use $packages
directly (or, if the intent was to pass a comma‑joined string to the go test
invocation, replace usage of $packages with $pkgList and keep the join). Locate
the assignment of $pkgList and either delete it or change the go test invocation
to consume the joined string depending on the intended behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c14cc438-2aee-418f-88c6-41bfcb64d70d

📥 Commits

Reviewing files that changed from the base of the PR and between 8509b18 and 2bf841f.

📒 Files selected for processing (4)
  • .github/workflows/test-go-windows.yml
  • orbit/pkg/bitlocker/bitlocker_management_windows_test.go
  • orbit/pkg/bitlocker/bitlocker_worker_windows.go
  • orbit/pkg/table/cis_audit/cis_audit_windows_test.go

@getvictor getvictor marked this pull request as ready for review April 10, 2026 02:17
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@getvictor
Copy link
Copy Markdown
Member Author

@lucasmrod Can you review this PR (mostly tests) since you're the codeowner for GitHub workflows?

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.

Windows 11 BitLocker loop

3 participants