Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Epic] Add snapshot tests (migrate to insta for tests) #15178

Open
2 tasks
blaginin opened this issue Mar 12, 2025 · 1 comment
Open
2 tasks

[Epic] Add snapshot tests (migrate to insta for tests) #15178

blaginin opened this issue Mar 12, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@blaginin
Copy link
Contributor

blaginin commented Mar 12, 2025

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

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:

@blaginin blaginin added the enhancement New feature or request label Mar 12, 2025
@alamb alamb changed the title [Epic] Add snapshot tests [Epic] Add snapshot tests (migrate to insta for tests) Mar 12, 2025
@shruti2522
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants