terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
chore: Detect changes in lists and sets
Test cases for changes in lists and sets. From the given time, I only went through essential cases that consisted of:
- Ignoring the order of list items after creation.
- Having the ability to update an item while ignoring the order. For the testing, I created a test resource because currently, we don't have anything to test more complex examples of certain resource behaviors (temporary providers we create for custom diff testing are not sufficient in this case). The resource is only added to the resource list whenever a special env is set (we could remove it entirely and leave some documentation in the resource file (and acc test file) on how to prepare for the tests). The imitation of external storage was done by creating a struct and its global instance (some of the things needed to be exported since external changes tested in acceptance tests needed to access those). Certain resource fields were researched to test different approaches, each is described in the implementation file.
Also added an assert on lists/sets that is able to assert items in order independent manner (it was needed for the tests of the proposals).
Note: Only lists were tested, because there was no major issue with them in current resources. For the lists the following issues were addressed: #420, #753
Next pr
- Apply (parameterized tests in object renaming test cases) https://github.com/Snowflake-Labs/terraform-provider-snowflake/pull/3130#discussion_r1802651147