Description
Is your feature request related to a problem or challenge?
Follow up on #15165, related to #10373
We currently have a lot of inline assertions when something is tested against a large pre-defined string(s). For example:
https://github.com/apache/datafusion/blob/main/datafusion/core/tests/dataframe/mod.rs#L2472-L2496
The issue with this approach is that every time we update logic, each of those tests needs to be updated manually. To make updates faster and easier, we're switching to insta. This issue will be a collection of small good-first-issue tickets to complete the transition.
Tickets to pick up
- Migrate dataframe tests to
insta
#15245 - Migrate datasource tests to
insta
#15246 - Migrate user_defined tests to
insta
#15247 - Migrate physical plan tests to
insta
#15248 - Migrate the following tests to
insta
#15282 - Migrate optimizer tests to
insta
#15396 - Migrate
datafusion/sql
tests toinsta
#15397 - Migrate subtrait tests to
insta
#15398 - Migrate
core
tests toinsta
#15791 - Migrate
logical_plan
tests toinsta
#15792 - Migrate
datafusion-cli
tests toinsta
#15795 - Migrate memory_pool/pool tests to insta #16099
In addition to the previous list, you can manually find places to rewrite logic. Generally, everything that uses assert_batches_sorted_eq
, assert_batches_eq
, assert_contains
, or just compares with a very big string is a good candidate.
Describe the solution you'd like
We should switch those assertions to insta
You can see one example of this transition in #15165
I made that change manually using IDE replace tools and a bit of regex. Initially, I just put @"placeholder"
as a RHS and then ran cargo insta test
to fill gaps and then confirmed it's the same as before via git diff. It didn't take a lot of time, but I think there are ways to make it faster:
- https://github.com/getgrit/gritql
- rust-analyzer Structured Search Replace
- Cursor / Other AI tool ☠️