(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestDumpAndImport(t *testing.T) { |
| 25 | if testing.Short() { |
| 26 | t.Skip() |
| 27 | } |
| 28 | t.Parallel() |
| 29 | |
| 30 | const wantTables = 8 |
| 31 | if len(Tables) != wantTables { |
| 32 | t.Fatalf("New table has added (want %d got %d), please add new tests for the table and update this check", wantTables, len(Tables)) |
| 33 | } |
| 34 | |
| 35 | db := dbtest.NewDB(t, "dumpAndImport", Tables...) |
| 36 | setupDBToDump(t, db) |
| 37 | dumpTables(t, db) |
| 38 | importTables(t, db) |
| 39 | |
| 40 | // Dump and assert golden again to make sure data aren't changed. |
| 41 | dumpTables(t, db) |
| 42 | } |
| 43 | |
| 44 | func setupDBToDump(t *testing.T, db *gorm.DB) { |
| 45 | vals := []any{ |
nothing calls this directly
no test coverage detected