| 106 | } |
| 107 | |
| 108 | func TestPostgres(t *testing.T) { |
| 109 | for version, port := range map[string]int{ |
| 110 | "10": 5430, |
| 111 | "11": 5431, |
| 112 | "12": 5432, |
| 113 | "13": 5433, |
| 114 | "14": 5434, |
| 115 | "15": 5435, |
| 116 | "16": 5436, |
| 117 | "17": 5437, |
| 118 | } { |
| 119 | addr := fmt.Sprintf("host=localhost port=%d user=postgres dbname=test password=pass sslmode=disable", port) |
| 120 | t.Run(version, func(t *testing.T) { |
| 121 | t.Parallel() |
| 122 | client := enttest.Open(t, dialect.Postgres, addr, opts) |
| 123 | defer client.Close() |
| 124 | for _, tt := range tests { |
| 125 | name := runtime.FuncForPC(reflect.ValueOf(tt).Pointer()).Name() |
| 126 | t.Run(name[strings.LastIndex(name, ".")+1:], func(t *testing.T) { |
| 127 | drop(t, client) |
| 128 | tt(t, client) |
| 129 | }) |
| 130 | } |
| 131 | }) |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | var ( |
| 136 | opts = enttest.WithMigrateOptions( |