Wire native pipeline run commands and invocation-wide overrides

This commit is contained in:
2026-11-22 03:51:08 +00:00
parent 2a9c5a6075
commit 0cbc2b39cb
19 changed files with 1529 additions and 1344 deletions

View File

@@ -0,0 +1,33 @@
package cli
import (
"bytes"
"errors"
"os"
"os/exec"
"path/filepath"
"runtime"
"testing"
)
func TestExecutableRunRoutesDeclareTheSameRequiredInputs(t *testing.T) {
binary := filepath.Join(t.TempDir(), "notarius")
build := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "build", "-o", binary, "../../cmd/notarius")
build.Env = append(os.Environ(), "GOWORK=off")
if output, err := build.CombinedOutput(); err != nil {
t.Fatalf("build executable: %v\n%s", err, output)
}
for _, route := range [][]string{{"run"}, {"pipeline", "run"}} {
help := exec.Command(binary, append(append([]string(nil), route...), "--help")...)
output, err := help.CombinedOutput()
if err != nil || !bytes.Contains(output, []byte("pipeline-id")) || !bytes.Contains(output, []byte("--input-file")) {
t.Fatalf("%v help: %v\n%s", route, err, output)
}
missingInput := exec.Command(binary, append(append([]string(nil), route...), "demo")...)
output, err = missingInput.CombinedOutput()
var exit *exec.ExitError
if !errors.As(err, &exit) || exit.ExitCode() != 2 || !bytes.Contains(output, []byte("--input-file")) {
t.Fatalf("%v missing input: %v\n%s", route, err, output)
}
}
}