package runnerproto_test import ( "amadan.net/oficina/equipo/internal/runner/provider" "amadan.net/oficina/equipo/internal/testci" "os" "os/exec" "path/filepath" "strings" "testing" ) func TestDirectBinaryBoundaries(t *testing.T) { for _, pkg := range []string{".", "../../cmd/equipo-runner"} { list := exec.Command("go", "list", "-deps", pkg) testci.GoCommand(t, list) raw, err := list.CombinedOutput() if err != nil { t.Fatal(err) } if strings.Contains(string(raw), "/internal/directlive") || pkg == "." && strings.Contains(string(raw), "/provider/codex") { t.Fatal("production binary links adapter/certification worker", pkg) } } } func TestCheckPolicyNoRedundantRunner(t *testing.T) { p, err := provider.BuildCheckPolicy(provider.CheckPolicyInputs{Workspace: t.TempDir(), GoRoot: t.TempDir(), ModuleCache: t.TempDir(), Binary: "/usr/bin/true", RunnerBinary: "/usr/bin/true", Bwrap: "/usr/bin/bwrap", Argv: []string{"/opt/codex"}}) if err != nil { t.Fatal(err) } for _, m := range p.Mounts { if m.Target == "/opt/equipo-runner" { t.Fatal("unused runner mount retained") } } } func TestRunnerPrerequisitesDoNotExecuteCodex(t *testing.T) { root := t.TempDir() marker := filepath.Join(root, "executed") binary := filepath.Join(root, "codex") if err := os.WriteFile(binary, []byte("#!/bin/sh\ntouch '"+marker+"'\necho 'codex-cli 0.165.0'\n"), 0700); err != nil { t.Fatal(err) } cmd := exec.Command("make", "-C", "../..", "runner-prerequisites") cmd.Env = append(os.Environ(), "EQUIPO_CODEX_PATH="+binary) testci.Files(t, "../../Makefile", "../../scripts/runner-prerequisites.py") _, err := cmd.CombinedOutput() if _, stat := os.Stat(marker); stat == nil { t.Fatal("CI executed a provider binary") } if err == nil { t.Fatal("unrecognized binary accepted") } }