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

[test-infra][1/n] Replace Move's .exp tests with cargo-insta #21003

Merged
merged 10 commits into from
Jan 29, 2025

Conversation

tnowacki
Copy link
Contributor

Description

  • This PR adds a wrapper around insta::assert_snapshot to ease migration from .exp files
  • Utilize this for move-docgen-testsuite (which was already using snapshot)
    • Moves snapshot files next to the toml files

Test plan

  • 👀

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@tnowacki tnowacki requested a review from a team January 29, 2025 19:30
Copy link

vercel bot commented Jan 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 29, 2025 9:37pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2025 9:37pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2025 9:37pm

Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this change so much! Left a comment where you can in fact have multiple assertions per-test and regenerate them all (even in the case of failure), so might be something worth adding to the doc comment.

Comment on lines +92 to +94
/// For ease of use and reviewing, `insta_assert` should be used at most once per test. When it
/// fails, it will stop the test. So if there are multiple snapshots in a given test, it would
/// require multiple test runs to review all the failures.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this is necessarily true -- see "Disabling Assertion Failure" here: https://insta.rs/docs/advanced/#disabling-assertion-failure. Might be worth mentioning this/pointing to it in case folks do want to generate multiple snapshots per test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll mention it, but I think given the fact that you can only skip it via an env (and not something in Settings) it is worth advising against. Just a lot of friction and what not

@tnowacki tnowacki temporarily deployed to sui-typescript-aws-kms-test-env January 29, 2025 21:35 — with GitHub Actions Inactive
@tnowacki tnowacki merged commit 8e6047e into MystenLabs:main Jan 29, 2025
43 checks passed
@tnowacki tnowacki deleted the insta-util branch January 29, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants