package thin import ( "os" "path/filepath" "testing" "amadan.net/oficina/equipo/internal/runner/workspace" ) func TestPiEngineeringToolchainConfiguration(t *testing.T) { r := newPiRig(t, fakePiInstall(t), bigBudget) r.e.O.Runner.GoRoot = t.TempDir() r.e.O.Runner.ModuleCache = t.TempDir() if err := os.WriteFile(filepath.Join(r.e.O.Runner.GoRoot, "VERSION"), []byte("fixture"), 0600); err != nil { t.Fatal(err) } bindings := r.conns.MeteredMine(r.ctx, connPerson) if len(bindings) != 1 { t.Fatal("missing metered binding") } for _, action := range []string{"implement", "inspect", "answer"} { t.Run(action, func(t *testing.T) { prep, reason := r.e.prepareMetered(workspace.TaskTree{Dir: t.TempDir()}, specialistRun{action: action, binding: bindings[0], names: []string{"ask_person"}}, t.TempDir(), []string{"api.tensorx.ai"}) if reason != "" { t.Fatal(reason) } defer prep.cleanup() if prep.policy.GoToolchain() != (action == "implement") { t.Fatal("wrong toolchain scope") } if action == "implement" && prep.policy.Env["GOPROXY"] != "off" { t.Fatal("Go is not offline") } }) } }