diff --git a/internal/endtoend/endtoend_test.go b/internal/endtoend/endtoend_test.go index c31d2beb5e..beca8d6023 100644 --- a/internal/endtoend/endtoend_test.go +++ b/internal/endtoend/endtoend_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "os" + osexec "os/exec" "path/filepath" "strings" "testing" @@ -102,6 +103,13 @@ func TestReplay(t *testing.T) { args := parseExec(t, path) expected := expectedStderr(t, path) + if args.Process != "" { + _, err := osexec.LookPath(args.Process) + if err != nil { + t.Skipf("executable not found: %s %s", args.Process, err) + } + } + switch args.Command { case "diff": err = cmd.Diff(ctx, cmd.Env{ExperimentalFeatures: true}, path, "", &stderr) @@ -144,6 +152,9 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) { if filepath.Base(path) == "sqlc.json" { return nil } + if filepath.Base(path) == "exec.json" { + return nil + } if strings.Contains(path, "https://github.com/kotlin/build") { return nil } @@ -199,6 +210,7 @@ func expectedStderr(t *testing.T, dir string) string { type exec struct { Command string `json:"command"` + Process string `json:"process"` } func parseExec(t *testing.T, dir string) exec { diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json new file mode 100644 index 0000000000..5be7ac8c74 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json @@ -0,0 +1,3 @@ +{ + "process": "sqlc-gen-json" +}