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

Add more shim representation tests #2456

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Sep 30, 2024

This PR simply adds test cases around tfgen and shim representations of various schemata found in SDKv2 and PF. For PF I went through the docs to cover each major advertised case. What's of special interest is pinning down when Pulumi generates object types.

It seems to be happening in two cases:

  1. when TF specifies object types directly in PF:
    - Single Nested Attribute
    - Object Attribute
    - Single Nested Block

  2. when TF specifies a block with MaxItems=1 that is a list or set in TF but is flattened to an object in Pulumi:
    - In SDKv2 this is typically a list-nested block with MaxItems=1, very common
    - In PF this may be a block with List Validators indicating that at most 1 item is supported; seems rare

It seems helpful to pin down what shim.Schema captures in each of these cases.

@t0yv0 t0yv0 assigned iwahbe and unassigned iwahbe Sep 30, 2024
@t0yv0
Copy link
Member Author

t0yv0 commented Sep 30, 2024

Guess could be interesting to add for PF set-of-object and list-of-object cases for attributes.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.90%. Comparing base (65dd45d) to head (35e0c00).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2456      +/-   ##
==========================================
- Coverage   56.90%   56.90%   -0.01%     
==========================================
  Files         369      369              
  Lines       50733    50736       +3     
==========================================
+ Hits        28869    28870       +1     
- Misses      20285    20288       +3     
+ Partials     1579     1578       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@t0yv0
Copy link
Member Author

t0yv0 commented Sep 30, 2024

Hmm linter is happy locally but not in CI. Perhaps not aligned on linter versions.

 ::high file=pkg/tfshim/sdk-v2/cty.go,line=164,col=32::G115: integer overflow conversion uint -> int64 (gosec)
  
  level=warning msg="[config_reader] The output format `github-actions` is deprecated, please use `colored-line-number`"

Copy link
Contributor

@VenelinMartinov VenelinMartinov left a comment

Choose a reason for hiding this comment

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

LGTM.

Linking #2231 as it covered some of the same grounds and had some interesting observations on similarities/differences between various TF Types represented in the Shim layer.

@t0yv0 t0yv0 merged commit cb8c4ed into master Oct 1, 2024
17 checks passed
@t0yv0 t0yv0 deleted the t0yv0/more-shim-representation-tests branch October 1, 2024 12:35
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.92.0.

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.

4 participants