You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
support PARTITION for mysqldef and psqldef, adding --skip-partition to psqldef (#1036)
* psqldef: --skip-partition* support PARTITION* support pg partitions* implement partition diff* fix minor issues* resolve a parser rule conflict* tweaks* handle mariadb/tidb variance for partition names* rewrite flavor algorithm: test with flavor is always run, and mis-setting of flavor is not allowed* disable git diff for parser.go* fix flavor behavior* remove unused code* fix tests
@@ -107,7 +86,7 @@ For development iterations, use these commands to run tests:
107
86
make test # Takes approximately 10 minutes to complete
108
87
```
109
88
110
-
###Run tests for specific`*def` tools
89
+
### Run tests foraspecificsqldef tool
111
90
112
91
Thetest runner is`gotestsum`, which is a wrapper around`go test` that provides a more readable output.
113
92
@@ -142,7 +121,7 @@ If you encounter `tls: handshake failure` errors with MySQL 5.7, enable RSA key
142
121
GODEBUG=tlsrsakex=1 go test ./cmd/mysqldef
143
122
```
144
123
145
-
The tests for mssqldef are flaky due tomssqlinstance issues. Insuch acase, restart it with`docker compose down mssql && docker compose up -d --wait mssql`,and run the tests again.
124
+
The testsfor mssqldef are flaky due toSQL Serverinstance issues. Inthatcase, restart it with`docker compose down mssql && docker compose up -d --wait mssql`,then run the tests again.
146
125
147
126
Fortest coverage:
148
127
@@ -209,8 +188,10 @@ TestCaseName:
209
188
# Maximum database version supported
210
189
max_version:"14.0"
211
190
212
-
# Database flavor requirement (mysqldef only)
213
-
# One of "mysql", "mariadb", "tidb"
191
+
# Database flavor requirement for flavor-specific features
192
+
# One of "mysql", "mariadb", "tidb" for mysqldef, and "pgvector" for psqldef
193
+
# Supports positive and negative matching like "!tidb" to exclude TiDB
194
+
# See "Flavor Behavior" section below for details
214
195
flavor:"mariadb"
215
196
216
197
# User to run the test as
@@ -227,6 +208,11 @@ TestCaseName:
227
208
# Use offline testing only for proprietary SQL dialects such as Aurora DSQL (defaults to false)
- Both omitted: idempotency-only test; DDLs are applied but not asserted (must be valid SQL unless`offline: true`)
239
225
226
+
#### Flavor Behavior
227
+
228
+
The`flavor` field controls flavor-specifictest behavior, which validates that tests correctly fail on non-matching flavors:
229
+
230
+
| Scenario| Result|
231
+
|----------|--------|
232
+
| Flavor matches,test passes| PASS|
233
+
| Flavor matches,test fails| FAIL|
234
+
| Flavor doesn't match, test fails | SKIP |
235
+
| Flavor doesn't match,test passes| FAIL|
236
+
237
+
This design ensures that flavor annotations are accurate. If you add`flavor: mariadb` to a test, thetest must actually fail on MySQL/TiDB. If it passes, the flavor annotation is wrong and should be removed.
238
+
240
239
#### Notes for Writing Tests
241
240
242
241
* YAMLtest cases default to`enable_drop: true`, which differs from the default behavior of sqldef tools
@@ -246,6 +245,7 @@ The `up` and `down` fields must both be specified or both be omitted:
246
245
- SQLite3
247
246
- SQL Server
248
247
* Add`legacy_ignore_quotes: false`fornew test cases. This is the default behaviorin the future.
248
+
* Do not add trivial comments totest cases. Instead, describe what is testedintestcase names.
249
249
250
250
## Documentation
251
251
@@ -261,8 +261,6 @@ Markdown files document the usage of each command. Keep them up to date:
261
261
Before considering a task complete, run these commands to ensure the code isin a good state: