Skip to content

Commit c8d493b

Browse files
authored
test: Skip tests if required plugins are missing (#2104)
* test: Skip tests if required plugins are missing * Fix failing test
1 parent d460c5d commit c8d493b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

internal/endtoend/endtoend_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"encoding/json"
77
"os"
8+
osexec "os/exec"
89
"path/filepath"
910
"strings"
1011
"testing"
@@ -102,6 +103,13 @@ func TestReplay(t *testing.T) {
102103
args := parseExec(t, path)
103104
expected := expectedStderr(t, path)
104105

106+
if args.Process != "" {
107+
_, err := osexec.LookPath(args.Process)
108+
if err != nil {
109+
t.Skipf("executable not found: %s %s", args.Process, err)
110+
}
111+
}
112+
105113
switch args.Command {
106114
case "diff":
107115
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) {
144152
if filepath.Base(path) == "sqlc.json" {
145153
return nil
146154
}
155+
if filepath.Base(path) == "exec.json" {
156+
return nil
157+
}
147158
if strings.Contains(path, "/kotlin/build") {
148159
return nil
149160
}
@@ -199,6 +210,7 @@ func expectedStderr(t *testing.T, dir string) string {
199210

200211
type exec struct {
201212
Command string `json:"command"`
213+
Process string `json:"process"`
202214
}
203215

204216
func parseExec(t *testing.T, dir string) exec {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"process": "sqlc-gen-json"
3+
}

0 commit comments

Comments
 (0)