From 0bd11c407001ae17745206f6ce9c66049e25a7b3 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Wed, 7 Jun 2023 16:23:20 -0700 Subject: [PATCH] fix test race condition --- e2etests-cli/main_test.go | 18 ++- .../board_import/hello-world-x-y.exp.svg | 95 +++++++++++++++ .../board_import/hello-world-x.exp.svg | 110 ++++++++++++++++++ .../hello-world.exp.svg} | 0 4 files changed, 217 insertions(+), 6 deletions(-) create mode 100644 e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x-y.exp.svg create mode 100644 e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x.exp.svg rename e2etests-cli/testdata/TestCLI_E2E/{board_import.exp.svg => board_import/hello-world.exp.svg} (100%) diff --git a/e2etests-cli/main_test.go b/e2etests-cli/main_test.go index c237651a0..c968c6f42 100644 --- a/e2etests-cli/main_test.go +++ b/e2etests-cli/main_test.go @@ -435,12 +435,18 @@ steps: { writeFile(t, dir, "y.d2", `meow`) err := runTestMain(t, ctx, dir, env, filepath.Join(dir, "hello-world.d2")) assert.Success(t, err) - svg := readFile(t, dir, "hello-world/x/y.svg") - assert.Testdata(t, ".svg", svg) - svg = readFile(t, dir, "hello-world/x/index.svg") - assert.Testdata(t, ".svg", svg) - svg = readFile(t, dir, "hello-world/index.svg") - assert.Testdata(t, ".svg", svg) + t.Run("hello-world-x-y", func(t *testing.T) { + svg := readFile(t, dir, "hello-world/x/y.svg") + assert.Testdata(t, ".svg", svg) + }) + t.Run("hello-world-x", func(t *testing.T) { + svg := readFile(t, dir, "hello-world/x/index.svg") + assert.Testdata(t, ".svg", svg) + }) + t.Run("hello-world", func(t *testing.T) { + svg := readFile(t, dir, "hello-world/index.svg") + assert.Testdata(t, ".svg", svg) + }) }, }, } diff --git a/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x-y.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x-y.exp.svg new file mode 100644 index 000000000..b0ba8badf --- /dev/null +++ b/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x-y.exp.svg @@ -0,0 +1,95 @@ +meow + + + diff --git a/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x.exp.svg new file mode 100644 index 000000000..d23c4b239 --- /dev/null +++ b/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world-x.exp.svg @@ -0,0 +1,110 @@ +y + + + + + + + + + + + + + + + diff --git a/e2etests-cli/testdata/TestCLI_E2E/board_import.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world.exp.svg similarity index 100% rename from e2etests-cli/testdata/TestCLI_E2E/board_import.exp.svg rename to e2etests-cli/testdata/TestCLI_E2E/board_import/hello-world.exp.svg