func Test_generateRenameMaps(t *testing.T) { currentReplicateDoDb := []*common.DataSource{ { TableSchema: "db1", TableSchemaRename: "db1-rename", Tables: []*common.Table{ { TableName: "tb1", TableRename: "db1-tb1-rename", TableSchema: "db1",
(t *testing.T)
| 449 | //} |
| 450 | |
| 451 | func Test_matchTable(t *testing.T) { |
| 452 | tableConfigs := []*common.Table{ |
| 453 | { |
| 454 | TableName: "tb1", |
| 455 | }, |
| 456 | { |
| 457 | TableRegex: "(\\w*)tb_rex", |
| 458 | }, |
| 459 | } |
| 460 | |
| 461 | rawReplicateDoDb := []*common.DataSource{ |
| 462 | { |
| 463 | TableSchema: "db1", |
| 464 | Tables: tableConfigs, |
| 465 | }, |
| 466 | { |
| 467 | TableSchema: "db2", |
| 468 | }, |
| 469 | { |
| 470 | TableSchemaRegex: "(\\w*)db_rex1", |
| 471 | }, |
| 472 | } |
| 473 | |
| 474 | type args struct { |
| 475 | schemaName string |
| 476 | tableName string |
| 477 | } |
| 478 | tests := []struct { |
| 479 | name string |
| 480 | args args |
| 481 | wantResult bool |
| 482 | }{ |
| 483 | { |
| 484 | name: "match_schema", |
| 485 | args: args{ |
| 486 | schemaName: "db1", |
| 487 | }, |
| 488 | wantResult: true, |
| 489 | }, |
| 490 | { |
| 491 | name: "match_schema", |
| 492 | args: args{ |
| 493 | schemaName: "db2", |
| 494 | tableName: "", |
| 495 | }, |
| 496 | wantResult: true, |
| 497 | }, |
| 498 | { |
| 499 | name: "match_schema_rex", |
| 500 | args: args{ |
| 501 | schemaName: "testdb_rex1", |
| 502 | tableName: "", |
| 503 | }, |
| 504 | wantResult: true, |
| 505 | }, |
| 506 | { |
| 507 | name: "match_table", |
| 508 | args: args{ |
nothing calls this directly
no test coverage detected