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

helper: Ignore issues order in helper.AssertIssues #363

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Jan 6, 2025

Follow up of terraform-linters/tflint-ruleset-terraform#216

Previously, helper.AssertIssues used in unit tests would even test whether the order of issues matched. However, the order in which the issues are emitted doesn't matter, as they will be sorted in the final output.

The order of iterations over a map is random, which makes test with AssertIssues flaky. Given this, it may not be a good idea to test the order in AssertIssues.

This PR adds cmpopts.SortSlices, which sorts issues, as a cmp.Option to AssertIssues and AssertIssuesWithoutRange, allowing you to ignore the order of issues.

@wata727 wata727 merged commit 5bb9ac7 into master Jan 6, 2025
5 checks passed
@wata727 wata727 deleted the ignore_order_in_assert_issues branch January 6, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant