run e2ecli watch tests serially

This commit is contained in:
Alexander Wang 2023-12-10 09:56:09 -08:00
parent 957879d2e2
commit 7a0003c87c
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 12 additions and 5 deletions

View file

@ -30,6 +30,7 @@ func TestCLI_E2E(t *testing.T) {
tca := []struct { tca := []struct {
name string name string
serial bool
skipCI bool skipCI bool
skip bool skip bool
run func(t *testing.T, ctx context.Context, dir string, env *xos.Env) run func(t *testing.T, ctx context.Context, dir string, env *xos.Env)
@ -662,6 +663,7 @@ i used to read
}, },
{ {
name: "watch-regular", name: "watch-regular",
serial: true,
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
writeFile(t, dir, "index.d2", ` writeFile(t, dir, "index.d2", `
a -> b a -> b
@ -712,6 +714,7 @@ layers: {
}, },
{ {
name: "watch-ok-link", name: "watch-ok-link",
serial: true,
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
// This link technically works because D2 interprets it as a URL, // This link technically works because D2 interprets it as a URL,
// and on local filesystem, that is whe path where the compilation happens // and on local filesystem, that is whe path where the compilation happens
@ -766,6 +769,7 @@ layers: {
}, },
{ {
name: "watch-bad-link", name: "watch-bad-link",
serial: true,
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
// Just verify we don't crash even with a bad link (it's treated as a URL, which users might have locally) // Just verify we don't crash even with a bad link (it's treated as a URL, which users might have locally)
writeFile(t, dir, "index.d2", ` writeFile(t, dir, "index.d2", `
@ -817,6 +821,7 @@ layers: {
}, },
{ {
name: "watch-imported-file", name: "watch-imported-file",
serial: true,
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
writeFile(t, dir, "a.d2", ` writeFile(t, dir, "a.d2", `
...@b ...@b
@ -895,7 +900,9 @@ c
for _, tc := range tca { for _, tc := range tca {
tc := tc tc := tc
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
if !tc.serial {
t.Parallel() t.Parallel()
}
if tc.skipCI && os.Getenv("CI") != "" { if tc.skipCI && os.Getenv("CI") != "" {
t.SkipNow() t.SkipNow()