(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestPlugin(t *testing.T) { |
| 109 | syncAfterWrite = true // turn on sync after write and wait before read |
| 110 | for _, ts := range testSpecs(t) { |
| 111 | ts := ts |
| 112 | t.Run(ts.testName, func(t *testing.T) { |
| 113 | t.Parallel() |
| 114 | if ts.Spec.Format == filetypes.FormatTypeParquet || ts.Spec.Compression != filetypes.CompressionTypeNone { |
| 115 | testPluginCustom(t, &ts.Spec) |
| 116 | } else { |
| 117 | testPlugin(t, &ts.Spec) |
| 118 | } |
| 119 | |
| 120 | fi, err := os.Stat(ts.baseDir) |
| 121 | assert.NoError(t, err) |
| 122 | assert.Truef(t, fi.IsDir(), "basedir %s is not a directory", ts.baseDir) |
| 123 | |
| 124 | fileCount := 0 |
| 125 | assert.NoError(t, filepath.WalkDir(ts.baseDir, func(path string, d os.DirEntry, err error) error { |
| 126 | assert.NoError(t, err) |
| 127 | if err != nil { |
| 128 | return err |
| 129 | } |
| 130 | t.Log("walking path", path) |
| 131 | if !d.IsDir() { |
| 132 | fileCount++ |
| 133 | } |
| 134 | if !assert.NotContainsf(t, path, "{", "path %s still contains template", path) { |
| 135 | return errors.New("test failed") |
| 136 | } |
| 137 | return nil |
| 138 | })) |
| 139 | |
| 140 | assert.NotZero(t, fileCount, "no files written to %s", ts.baseDir) |
| 141 | }) |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | func testPlugin(t *testing.T, s *spec.Spec) { |
| 146 | ctx := context.Background() |
nothing calls this directly
no test coverage detected