(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestValidSchema(t *testing.T) { |
| 14 | for _, replay := range FindTests(t, "testdata", "base") { |
| 15 | replay := replay // https://golang.org/doc/faq#closures_and_goroutines |
| 16 | |
| 17 | if replay.Exec != nil { |
| 18 | if replay.Exec.Meta.InvalidSchema { |
| 19 | continue |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | file := filepath.Join(replay.Path, replay.ConfigName) |
| 24 | rd, err := os.Open(file) |
| 25 | if err != nil { |
| 26 | t.Fatal(err) |
| 27 | } |
| 28 | |
| 29 | conf, err := config.ParseConfig(rd) |
| 30 | if err != nil { |
| 31 | t.Fatal(err) |
| 32 | } |
| 33 | |
| 34 | for j, pkg := range conf.SQL { |
| 35 | j, pkg := j, pkg |
| 36 | switch pkg.Engine { |
| 37 | case config.EnginePostgreSQL: |
| 38 | // pass |
| 39 | case config.EngineMySQL: |
| 40 | // pass |
| 41 | default: |
| 42 | continue |
| 43 | } |
| 44 | t.Run(fmt.Sprintf("endtoend-%s-%d", file, j), func(t *testing.T) { |
| 45 | t.Parallel() |
| 46 | |
| 47 | var schema []string |
| 48 | for _, path := range pkg.Schema { |
| 49 | schema = append(schema, filepath.Join(filepath.Dir(file), path)) |
| 50 | } |
| 51 | |
| 52 | switch pkg.Engine { |
| 53 | case config.EnginePostgreSQL: |
| 54 | local.PostgreSQL(t, schema) |
| 55 | case config.EngineMySQL: |
| 56 | local.MySQL(t, schema) |
| 57 | } |
| 58 | }) |
| 59 | } |
| 60 | } |
| 61 | } |
nothing calls this directly
no test coverage detected