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

SDKv2 Test Set types in Diff #2789

Closed
VenelinMartinov opened this issue Dec 24, 2024 · 0 comments · Fixed by #2839
Closed

SDKv2 Test Set types in Diff #2789

VenelinMartinov opened this issue Dec 24, 2024 · 0 comments · Fixed by #2839
Assignees
Labels
kind/engineering Work that is not visible to an external user resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Dec 24, 2024

For schemas containing properties with the following collection variations:

  • set attribute
  • set block

the following schema variations:

  • Optional
  • Required
  • Optional + Computed
    • set in the program
    • set by the provider
  • Nested Optional + Computed
    • set in the program
    • set by the provider
  • Fully Computed
  • Defaults on the collection property
  • Defaults on any nested properties

we should additionally test each of these with:

  • ForceNew on the collection property
  • ForceNew on any nested properties
  • MaxItemsOne
  • MaxItemsOne and ForceNew

We should test the various cases which can occur when previewing changes:

  • empty unchanged
  • non-empty unchanged
  • added empty
  • added non-empty
  • removed empty
  • removed non-empty
  • one property changed

For non-MaxItemsOne we should also test the following scenarios:

  • element added to the front
  • element added in the middle
  • element added at the back
  • element removed from the front
  • element removed from the middle
  • element removed from the back
  • same element updated
  • shuffled
  • shuffled with duplicates
  • shuffled added front
  • shuffled added middle
  • shuffled added end
  • shuffled removed front
  • shuffled removed middle
  • shuffled removed end
  • two added
  • two removed
  • two added and two removed shuffled, one overlaps
  • two added and two removed shuffled, no overlaps
  • two added and two removed shuffled, with duplicates

For each of these scenarios we should also test:

  • and unordered version of the scenario, where the elements are in a different lexicographical order, since that matters for re-ordering during planning
@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Dec 24, 2024
@VenelinMartinov VenelinMartinov added kind/engineering Work that is not visible to an external user and removed needs-triage Needs attention from the triage team labels Dec 24, 2024
VenelinMartinov added a commit that referenced this issue Jan 17, 2025
This PR refactors the Set and List Diff tests to use the generic diff
utility functions and types introduced in
#2829. This should
make the tests more maintainable and more in-line with what other tests
do.


[861ec1f](861ec1f)
contains the changes:
- Refactors the tests to use the generic `diffSchemaValueMakerPair` and
`diffScenario` types for their tests.
- Refactors the tests to use `prop` for top-level properties and
`nested_prop` for nested ones, like the rest of the tests.
- Refactors the tests to use the generic `runSDKv2TestMatrix` test
function.
- Refactors the `valueMaker` functions from `value_makers.go` to return
a `map[string]cty.Value ` instead of a `cty.Value` which needs to be
transformed further after.
- Corrects three tests in `list element removed`, where the order of the
elements was wrong in the changed values.



[f800d2d](f800d2d)
contains the test recordings.

Related to #2788
Related to #2789
VenelinMartinov added a commit that referenced this issue Jan 17, 2025
This PR adds Diff tests for Defaults in Set and List schemas. Note that
the List and Set themselves can not have Defaults, since TF throws an
error on these: `Default is not valid for lists or sets`.

Related to #2788
Related to #2789
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/engineering Work that is not visible to an external user resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants