Skip to content

fix: guard Linux-only platform helpers#204

Open
saurabhhhcodes wants to merge 1 commit into
optiqor:mainfrom
saurabhhhcodes:fix-chaos-nanosleep-darwin
Open

fix: guard Linux-only platform helpers#204
saurabhhhcodes wants to merge 1 commit into
optiqor:mainfrom
saurabhhhcodes:fix-chaos-nanosleep-darwin

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move the CPU chaos scenario sleep call behind a platform helper
  • keep Linux on unix.Nanosleep so scheduler wakeup behavior is preserved
  • use time.Sleep on non-Linux platforms so the chaos package can compile and run targeted tests on macOS
  • guard the Linux inotify-based audit implementation behind linux build tags
  • add a non-Linux audit command stub that reports the unsupported platform instead of breaking compilation

Validation

  • env GOCACHE=/private/tmp/kerno-go-build-cache go test ./internal/chaos -run 'TestScenarios/cpu|TestRunDispatchesScenario|TestRegistryHasAllScenarios|TestIntensity|TestPaired' -count=1
  • env GOCACHE=/private/tmp/kerno-go-build-cache go test ./internal/chaos -run '^$'
  • env GOCACHE=/private/tmp/kerno-go-build-cache GOOS=linux GOARCH=amd64 go test -c -o /private/tmp/kerno-chaos-linux.test ./internal/chaos
  • env GOCACHE=/private/tmp/kerno-go-build-cache go test ./cmd/kerno -run '^$'
  • env GOCACHE=/private/tmp/kerno-go-build-cache go test ./internal/cli -run 'Test.*Audit|TestRoot|TestCompletion|Test.*Flags' -count=1
  • env GOCACHE=/private/tmp/kerno-go-build-cache GOOS=linux GOARCH=amd64 go test -c -o /private/tmp/kerno-linux.test ./cmd/kerno
  • git diff --check

The full go test ./internal/chaos package run is still blocked in this sandbox by the unrelated tcp-churn smoke test requiring a local TCP listener: listen tcp 127.0.0.1:0: bind: operation not permitted.

@saurabhhhcodes saurabhhhcodes requested a review from btwshivam as a code owner June 8, 2026 09:52
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🚀 First PR — welcome aboard!

A few things to expect:

  1. CI: every PR runs build + race tests + lint + (eventually) the kernel matrix. If something fails, the log will tell you exactly which gate.
  2. DCO: every commit needs Signed-off-by:git commit -s adds it automatically.
  3. Conventional Commits: PR titles like feat(doctor): add new rule or fix(bpf): handle X. We squash-merge by default.
  4. Review: a maintainer will review within 72 hours. Suggestions are conversations, not orders — push back if something doesn't fit your context.

If you get stuck, reply here or jump to Discussions. We want this PR to land.

@github-actions github-actions Bot added the level:intermediate 50-200 lines or 3-5 files (auto-applied) label Jun 8, 2026
@saurabhhhcodes saurabhhhcodes force-pushed the fix-chaos-nanosleep-darwin branch from d2e867c to 910532a Compare June 8, 2026 09:55
@github-actions github-actions Bot added level:advanced 200+ lines or 6+ files (auto-applied) and removed level:intermediate 50-200 lines or 3-5 files (auto-applied) labels Jun 8, 2026
@saurabhhhcodes saurabhhhcodes changed the title fix(chaos): guard nanosleep behind platform helper fix: guard Linux-only platform helpers Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:advanced 200+ lines or 6+ files (auto-applied)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant