()
| 52 | } |
| 53 | |
| 54 | func writeManyRows() error { |
| 55 | ctx := context.Background() |
| 56 | p := plugin.NewPlugin("mysql", "development", New) |
| 57 | s := &Spec{ |
| 58 | ConnectionString: getConnectionString(), |
| 59 | } |
| 60 | specBytes, err := json.Marshal(s) |
| 61 | if err != nil { |
| 62 | return err |
| 63 | } |
| 64 | if err := p.Init(ctx, specBytes, plugin.NewClientOptions{}); err != nil { |
| 65 | return err |
| 66 | } |
| 67 | |
| 68 | const numberOfTables = 5 |
| 69 | const recordsPerTable = 20 |
| 70 | msgs := make([]message.WriteMessage, 0) |
| 71 | for i := 0; i < numberOfTables; i++ { |
| 72 | tableName := fmt.Sprintf("table_%d", i) |
| 73 | table := schema.TestTable(tableName, schema.TestSourceOptions{}) |
| 74 | table.Columns = append(table.Columns, schema.Column{Name: "name", Type: arrow.BinaryTypes.String, PrimaryKey: true}) |
| 75 | msgs = append(msgs, &message.WriteMigrateTable{Table: table}) |
| 76 | |
| 77 | tg := schema.NewTestDataGenerator(0) |
| 78 | for i := 0; i < recordsPerTable; i++ { |
| 79 | record := tg.Generate(table, schema.GenTestDataOptions{ |
| 80 | MaxRows: 50, |
| 81 | }) |
| 82 | msgs = append(msgs, &message.WriteInsert{Record: record}) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | err = p.WriteAll(ctx, msgs) |
| 87 | return err |
| 88 | } |
| 89 | |
| 90 | func TestWriteManyRows(t *testing.T) { |
| 91 | err := writeManyRows() |
no test coverage detected