Skip to content

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
wata727 added a commit to terraform-linters/tflint-ruleset-terraform that referenced this pull request Mar 12, 2025
wata727 added a commit to terraform-linters/tflint-ruleset-terraform that referenced this pull request Mar 12, 2025
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