Download this file
| 1 | package thin |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "path/filepath" |
| 6 | "testing" |
| 7 | |
| 8 | "amadan.net/oficina/equipo/internal/runner/workspace" |
| 9 | ) |
| 10 | |
| 11 | func TestPiEngineeringToolchainConfiguration(t *testing.T) { |
| 12 | r := newPiRig(t, fakePiInstall(t), bigBudget) |
| 13 | r.e.O.Runner.GoRoot = t.TempDir() |
| 14 | r.e.O.Runner.ModuleCache = t.TempDir() |
| 15 | if err := os.WriteFile(filepath.Join(r.e.O.Runner.GoRoot, "VERSION"), []byte("fixture"), 0600); err != nil { |
| 16 | t.Fatal(err) |
| 17 | } |
| 18 | bindings := r.conns.MeteredMine(r.ctx, connPerson) |
| 19 | if len(bindings) != 1 { |
| 20 | t.Fatal("missing metered binding") |
| 21 | } |
| 22 | for _, action := range []string{"implement", "inspect", "answer"} { |
| 23 | t.Run(action, func(t *testing.T) { |
| 24 | 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"}) |
| 25 | if reason != "" { |
| 26 | t.Fatal(reason) |
| 27 | } |
| 28 | defer prep.cleanup() |
| 29 | if prep.policy.GoToolchain() != (action == "implement") { |
| 30 | t.Fatal("wrong toolchain scope") |
| 31 | } |
| 32 | if action == "implement" && prep.policy.Env["GOPROXY"] != "off" { |
| 33 | t.Fatal("Go is not offline") |
| 34 | } |
| 35 | }) |
| 36 | } |
| 37 | } |
| 38 | |