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

Refactor MakeTerraformInput tests #1853

Merged
merged 1 commit into from
Apr 11, 2024
Merged

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Apr 10, 2024

As part of hardening the bridge, revisit tests for MakeTerraformInput.

It turns out that a lot of these tests used schema examples that do not pass InternalValidate that bridged providers should be running at build-time, and therefore these tests do not represent functionality actually used in production.

To assist making sure we can write good tests, shim layer is extended to expose SchemaMap.Validate().

Where possible, the test cases were corrected to pass the validation.

One exception is map_with_resource_elem test case that is discarded as this is rejected by the validation. Instead, a test case for regular map attributes is added.

Several test cases are suspect and may be regression-testing incorrect behavior, NOTE is added for those.

Finally, test cases are rearranged into table-driven tests to make them easier to maintain.

As part of hardening the bridge, revisit tests for MakeTerraformInput.

It turns out that a lot of these tests used schema examples that do not pass InternalValidate that bridged providers
should be running at build-time, and therefore these tests do not represent functionality actually used in production.

To assist making sure we can write good tests, shim layer is extended to expose SchemaMap.Validate().

Where possible, the test cases were corrected to pass the validation.

One exception is map_with_resource_elem test case that is discarded as this is rejected by the validation. Instead, a
test case for regular map attributes is added.

Several test cases are suspect and may be regression-testing incorrect behavior, NOTE is added for those.

Finally, test cases are rearranged into table-driven tests to make them easier to maintain.
Copy link

codecov bot commented Apr 10, 2024

Codecov Report

Attention: Patch coverage is 53.33333% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 60.46%. Comparing base (cffb553) to head (3bf80d0).

Files Patch % Lines
pf/internal/schemashim/object_pseudoresource.go 0.00% 4 Missing ⚠️
pkg/tfshim/schema/schema.go 0.00% 2 Missing ⚠️
pf/internal/schemashim/schema_map.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1853      +/-   ##
==========================================
- Coverage   61.06%   60.46%   -0.60%     
==========================================
  Files         303      310       +7     
  Lines       42442    42835     +393     
==========================================
- Hits        25916    25900      -16     
- Misses      15055    15461     +406     
- Partials     1471     1474       +3     

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

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.

looks good, thanks for fixing

@t0yv0 t0yv0 merged commit a38a786 into master Apr 11, 2024
10 checks passed
@t0yv0 t0yv0 deleted the t0yv0/refactor-test-terraform-inputs branch April 11, 2024 12:44
@t0yv0 t0yv0 mentioned this pull request Apr 12, 2024
iwahbe added a commit that referenced this pull request Apr 12, 2024
Followup to #1853.

Since #1851 also
edits these tests, I thought they should also have (and require) correct
types.
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.

None yet

2 participants