feat: P0-2d add no-CGO stubs for heartbeat, select, cleanup

Add four function stubs to backend/stub.go for the !cgo build path:
- StartHeartbeat(ctx context.Context) — no-op (heartbeat not available)
- SetHeartbeatInterval(secs int) — no-op (interval update not available)
- EvalSelectForHost(hostname, selectExpr string) error — returns errNoCGO
- Cleanup() — no-op (no C resources to release without CGO)

TDD: four tests in stub_funcs_test.go verify stubs behave correctly
(no-op functions don't panic, error stubs return errNoCGO). All backend
tests passing.
This commit is contained in:
Rongsong Shen 2026-04-17 10:02:11 +00:00
parent f354a5ec78
commit dc029a6d14
3 changed files with 58 additions and 3 deletions

View file

@ -76,9 +76,10 @@
- `controllers/rbac_check_test.go` — 3 new TDD tests: `TestRBAC_HostControl_ClusterAdminOnly`, `TestRBAC_HostView_BasicUserHasAccess`, `TestRBAC_HostControl_DomainTypeIsAll`
- All tests passing (`controllers` package)
- [ ] **#9 P0-2d: Update stub.go with new function stubs**
- `backend/stub.go` — Keep `ControlHost` stub (return `errNoCGO`), add `StartHeartbeat(ctx context.Context){}`, `SetHeartbeatInterval(secs int){}`, `EvalSelectForHost(...)` returning `errNoCGO`, `Cleanup(){}`
- Add `"context"` to import block
- [x] **#9 P0-2d: Update stub.go with new function stubs**
- `backend/stub.go` — Added `StartHeartbeat(_ context.Context){}`, `SetHeartbeatInterval(_ int){}`, `EvalSelectForHost(_, _ string) error` (returns `errNoCGO`), `Cleanup(){}`, added `"context"` to imports
- `backend/stub_funcs_test.go` — 4 TDD tests: `TestStartHeartbeat_StubNoOp`, `TestSetHeartbeatInterval_StubNoOp` (3 edge values), `TestEvalSelectForHost_StubErrNoCGO`, `TestCleanup_StubNoOp`
- All backend tests passing
---