testFileWriterIntegration builds and run a topology reading from testdata/filewriter/input.csv.log.zst and using the FileWriter output, configured with the given pathString (in pathString, "TMPDIR" gets replaced at runtime by the test case temporary directory). Once the topology exits, the content
(t *testing.T, pathString string)
| 284 | // |
| 285 | // To update the golden file, run: go test -race -run TestName -update |
| 286 | func testFileWriterIntegrationDeterministic(t *testing.T, pathString string) { |
| 287 | const procs = 1 |
| 288 | const rotate = -1 |
| 289 | |
| 290 | tmpDir := t.TempDir() |
| 291 | testFileWriterIntegration(t, tmpDir, pathString, procs, rotate) |
| 292 | |
| 293 | buf := &bytes.Buffer{} |
| 294 | if err := dirtree.Write(buf, tmpDir, dirtree.ModeAll, dirtree.ExcludeRoot); err != nil { |
| 295 | t.Fatal(err) |
| 296 | } |
| 297 | |
| 298 | golden := filepath.Join("testdata", "filewriter", t.Name()+".golden") |
| 299 | if testutil.UpdateGolden != nil && *testutil.UpdateGolden { |
| 300 | if err := os.WriteFile(golden, buf.Bytes(), os.ModePerm); err != nil { |
| 301 | t.Fatalf("can't update golden file: %v", err) |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | testutil.DiffWithGolden(t, buf.Bytes(), golden) |
| 306 | if t.Failed() { |
| 307 | dirCpy := filepath.Join(os.TempDir(), t.Name()+".golden") |
| 308 | fmt.Printf("ERROR: copying output directory to %q for investigation\n\n", dirCpy) |
| 309 | if err := testutil.CopyDirectory(tmpDir, dirCpy); err != nil { |
| 310 | t.Fatal(err) |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | // testFileWriterIntegrationCheckRecords builds and run a topology reading from |
| 316 | // /testdata/filewriter/input.csv.log.zst and using the FileWriter output, |
no test coverage detected