From 1beb6119e9b33dd031bc7e87c77332cb83457b60 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Mon, 17 Apr 2023 10:59:32 +0100 Subject: [PATCH 1/4] chore(testing): Move `.snapshots` to `testdata` --- plugins/source/docs_test.go | 6 ++++-- .../TestGeneratePluginDocs-JSON-__tables.json | 0 .../TestGeneratePluginDocs-Markdown-README.md | 0 .../TestGeneratePluginDocs-Markdown-incremental_table.md | 0 ...GeneratePluginDocs-Markdown-relation_relation_table_a.md | 0 ...GeneratePluginDocs-Markdown-relation_relation_table_b.md | 0 .../TestGeneratePluginDocs-Markdown-relation_table.md | 0 .../TestGeneratePluginDocs-Markdown-test_table.md | 0 8 files changed, 4 insertions(+), 2 deletions(-) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-JSON-__tables.json (100%) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-Markdown-README.md (100%) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-Markdown-incremental_table.md (100%) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-Markdown-relation_relation_table_a.md (100%) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-Markdown-relation_relation_table_b.md (100%) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-Markdown-relation_table.md (100%) rename plugins/source/{.snapshots => testdata}/TestGeneratePluginDocs-Markdown-test_table.md (100%) diff --git a/plugins/source/docs_test.go b/plugins/source/docs_test.go index 1f29190050..9d0a59d459 100644 --- a/plugins/source/docs_test.go +++ b/plugins/source/docs_test.go @@ -103,6 +103,8 @@ var testTables = []*schema.Table{ func TestGeneratePluginDocs(t *testing.T) { p := NewPlugin("test", "v1.0.0", testTables, newTestExecutionClient) + cup := cupaloy.New(cupaloy.SnapshotSubdirectory("testdata")) + t.Run("Markdown", func(t *testing.T) { tmpdir := t.TempDir() @@ -117,7 +119,7 @@ func TestGeneratePluginDocs(t *testing.T) { output := path.Join(tmpdir, exp) got, err := os.ReadFile(output) require.NoError(t, err) - cupaloy.SnapshotT(t, got) + cup.SnapshotT(t, got) }) } }) @@ -136,7 +138,7 @@ func TestGeneratePluginDocs(t *testing.T) { output := path.Join(tmpdir, exp) got, err := os.ReadFile(output) require.NoError(t, err) - cupaloy.SnapshotT(t, got) + cup.SnapshotT(t, got) }) } }) diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-JSON-__tables.json b/plugins/source/testdata/TestGeneratePluginDocs-JSON-__tables.json similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-JSON-__tables.json rename to plugins/source/testdata/TestGeneratePluginDocs-JSON-__tables.json diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-README.md b/plugins/source/testdata/TestGeneratePluginDocs-Markdown-README.md similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-README.md rename to plugins/source/testdata/TestGeneratePluginDocs-Markdown-README.md diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-incremental_table.md b/plugins/source/testdata/TestGeneratePluginDocs-Markdown-incremental_table.md similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-incremental_table.md rename to plugins/source/testdata/TestGeneratePluginDocs-Markdown-incremental_table.md diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-relation_relation_table_a.md b/plugins/source/testdata/TestGeneratePluginDocs-Markdown-relation_relation_table_a.md similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-relation_relation_table_a.md rename to plugins/source/testdata/TestGeneratePluginDocs-Markdown-relation_relation_table_a.md diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-relation_relation_table_b.md b/plugins/source/testdata/TestGeneratePluginDocs-Markdown-relation_relation_table_b.md similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-relation_relation_table_b.md rename to plugins/source/testdata/TestGeneratePluginDocs-Markdown-relation_relation_table_b.md diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-relation_table.md b/plugins/source/testdata/TestGeneratePluginDocs-Markdown-relation_table.md similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-relation_table.md rename to plugins/source/testdata/TestGeneratePluginDocs-Markdown-relation_table.md diff --git a/plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-test_table.md b/plugins/source/testdata/TestGeneratePluginDocs-Markdown-test_table.md similarity index 100% rename from plugins/source/.snapshots/TestGeneratePluginDocs-Markdown-test_table.md rename to plugins/source/testdata/TestGeneratePluginDocs-Markdown-test_table.md From a2f86ecc2d963ff4958ab64a2ada2d23c43b89fb Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Mon, 17 Apr 2023 11:01:42 +0100 Subject: [PATCH 2/4] update vale flags --- .github/workflows/lint_markdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml index 9db31535fd..33d3cad02e 100644 --- a/.github/workflows/lint_markdown.yml +++ b/.github/workflows/lint_markdown.yml @@ -15,7 +15,7 @@ jobs: - name: Vale uses: errata-ai/vale-action@v2 with: - vale_flags: "--glob=!{plugins/source/.snapshots/*,CHANGELOG.md,.github/styles/proselint/README.md}" + vale_flags: "--glob=!{plugins/source/testdata/*,CHANGELOG.md,.github/styles/proselint/README.md}" filter_mode: nofilter env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From 50583187c89976915cbe4527785b66c9f4ca1c35 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Mon, 17 Apr 2023 12:24:53 +0100 Subject: [PATCH 3/4] ignore in lint-structure --- .github/workflows/lint_markdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml index 33d3cad02e..9dee0d576c 100644 --- a/.github/workflows/lint_markdown.yml +++ b/.github/workflows/lint_markdown.yml @@ -29,4 +29,4 @@ jobs: with: files: . config_file: .markdownlint.yaml - ignore_files: "CHANGELOG.md" + ignore_files: "plugins/source/testdata/*,CHANGELOG.md" From 958ad88b6da9b82a192391b387645e38dc39b980 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Mon, 17 Apr 2023 12:34:47 +0100 Subject: [PATCH 4/4] oops --- .github/workflows/lint_markdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml index 9dee0d576c..a61261d07e 100644 --- a/.github/workflows/lint_markdown.yml +++ b/.github/workflows/lint_markdown.yml @@ -29,4 +29,4 @@ jobs: with: files: . config_file: .markdownlint.yaml - ignore_files: "plugins/source/testdata/*,CHANGELOG.md" + ignore_files: '{plugins/source/testdata/*,CHANGELOG.md}'