agent/pkg/agentic/helpers_test.go
Snider 9c6f10902e fix(agent): mcp.Register startup panic + test isolation + CLI test standard
- Replace broken registerMCPService with mcp.Register (fixes nil ServiceRuntime panic)
- Remove dead mcp_service.go, update tests to use mcp.Register directly
- Add setTestWorkspace() helper to clear workspaceRootOverride between tests
- Fix 40+ test files with workspace state poisoning from loadAgentConfig
- Fix forge.lthn.ai → dappco.re in findConsumersList test
- Fix BranchWorkspaceCount test to use isolated temp dir
- Add CLI test standard: 32 tests across 19 subsystems (tests/cli/)
- All 9 packages pass, 0 failures

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 16:15:14 +01:00

15 lines
453 B
Go

// SPDX-License-Identifier: EUPL-1.2
package agentic
import "testing"
// setTestWorkspace sets CORE_WORKSPACE and clears the package-level
// workspaceRootOverride so tests aren't poisoned by prior test runs
// that called setWorkspaceRootOverride via loadAgentConfig.
func setTestWorkspace(t *testing.T, root string) {
t.Helper()
t.Setenv("CORE_WORKSPACE", root)
setWorkspaceRootOverride("")
t.Cleanup(func() { setWorkspaceRootOverride("") })
}