(t *testing.T)
| 435 | } |
| 436 | |
| 437 | func TestSourceAndModelNameCollission(t *testing.T) { |
| 438 | // Add source for a file |
| 439 | rt, id := testruntime.NewInstance(t) |
| 440 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 441 | "/data/foo.csv": `a,b,c,d,e |
| 442 | 1,2,3,4,5 |
| 443 | 1,2,3,4,5 |
| 444 | 1,2,3,4,5 |
| 445 | `, |
| 446 | "/sources/foo.yaml": ` |
| 447 | connector: local_file |
| 448 | path: data/foo.csv |
| 449 | `, |
| 450 | }) |
| 451 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 452 | testruntime.RequireReconcileState(t, rt, id, 2, 0, 0) |
| 453 | testruntime.RequireOLAPTable(t, rt, id, "foo") |
| 454 | |
| 455 | // Create a source with same name within a different folder |
| 456 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 457 | "/other_folder/foo.yaml": ` |
| 458 | type: source |
| 459 | connector: local_file |
| 460 | path: data/foo.csv |
| 461 | `, |
| 462 | }) |
| 463 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 464 | testruntime.RequireReconcileState(t, rt, id, 2, 1, 1) |
| 465 | testruntime.RequireOLAPTable(t, rt, id, "foo") |
| 466 | |
| 467 | // Deleting the other file marks the other as valid |
| 468 | testruntime.DeleteFiles(t, rt, id, "/other_folder/foo.yaml") |
| 469 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 470 | testruntime.RequireReconcileState(t, rt, id, 2, 0, 0) |
| 471 | testruntime.RequireOLAPTable(t, rt, id, "foo") |
| 472 | |
| 473 | // Create a source with same name using `name` annotation |
| 474 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 475 | "/sources/foo_1.yaml": ` |
| 476 | name: foo |
| 477 | connector: local_file |
| 478 | path: data/foo.csv |
| 479 | `, |
| 480 | }) |
| 481 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 482 | testruntime.RequireReconcileState(t, rt, id, 2, 1, 1) |
| 483 | testruntime.RequireOLAPTable(t, rt, id, "foo") |
| 484 | |
| 485 | // Deleting the other file marks the other as valid |
| 486 | testruntime.DeleteFiles(t, rt, id, "/sources/foo_1.yaml") |
| 487 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 488 | testruntime.RequireReconcileState(t, rt, id, 2, 0, 0) |
| 489 | testruntime.RequireOLAPTable(t, rt, id, "foo") |
| 490 | |
| 491 | // Create a model with same name as the source |
| 492 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 493 | "/models/foo.sql": `SELECT 1`, |
| 494 | }) |
nothing calls this directly
no test coverage detected