Download this file
| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "os/exec" |
| 5 | "strings" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | // The served binary stays clean (Paul, 2026-11-16, Q1): the adoption |
| 10 | // runner's CARLOS half, its Admin client and agent-access's client are |
| 11 | // alta-adopt's alone. None of them may reach cmd/alta, directly or |
| 12 | // through anything it imports. |
| 13 | func TestServedAltaImportsNoAdoptionCode(t *testing.T) { |
| 14 | out, err := exec.Command("go", "list", "-deps", "amadan.net/oficina/alta/cmd/alta").CombinedOutput() |
| 15 | if err != nil { |
| 16 | t.Fatalf("go list: %v\n%s", err, out) |
| 17 | } |
| 18 | deps := strings.Fields(string(out)) |
| 19 | if len(deps) < 10 { |
| 20 | t.Fatalf("go list found %d packages", len(deps)) |
| 21 | } |
| 22 | for _, p := range deps { |
| 23 | switch { |
| 24 | case p == "amadan.net/oficina/alta/adopt" || strings.HasPrefix(p, "amadan.net/oficina/alta/adopt/"), |
| 25 | p == "amadan.net/oficina/alta/carlosop" || strings.HasPrefix(p, "amadan.net/oficina/alta/carlosop/"), |
| 26 | strings.HasPrefix(p, "amadan.net/oficina/agent-access"): |
| 27 | t.Errorf("cmd/alta imports %s", p) |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |