Skip to content

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

Open
@blaginin

Description

@blaginin

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions