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

Fix custom timeout propagation for Update #1749

Merged
merged 4 commits into from
Mar 11, 2024

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Mar 11, 2024

Fixes a regression responsible for the pulumi/pulumi-aws#3442 P1.

When refactoring timeout handling in #1648 the behavior of custom timeouts for Update and Delete was inadvertently broken, but passed the test suite.

The regression was introduced in v3.72.0 of the bridge and affects all SDKv2 based resources. Custom timeouts were not respected for Update and Delete but were respected for Create.

The fix is very self-contained but this PR also backfills test coverage with a matrix of tests for custom timeout propagation and respecting both schema-based and user-based timeouts.

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.26%. Comparing base (22fdb29) to head (6e6d669).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1749      +/-   ##
==========================================
- Coverage   59.75%   59.26%   -0.50%     
==========================================
  Files         300      307       +7     
  Lines       42025    42403     +378     
==========================================
+ Hits        25111    25129      +18     
- Misses      15488    15852     +364     
+ Partials     1426     1422       -4     

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

}
switch tc.cud {
case "Update", "Delete":
return "TODO[pulumi/pulumi-terraform-bridge#1651] - schema-specified timeouts are not " +
Copy link
Member Author

Choose a reason for hiding this comment

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

This suspicion is now confirmed for #1651 - custom Delete or Update timeouts from the upstream provider schema are not currently respected. Any chance that's by design? If we want it respected I can follow up with a quick PR here.

Copy link
Member

Choose a reason for hiding this comment

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

Unless we can find a reason why they are not respected, let's respect them.

This is less Chesterton's fence then a pile of scattered sticks in a field.

@t0yv0 t0yv0 marked this pull request as ready for review March 11, 2024 18:38
@@ -1684,7 +1684,7 @@ func transformFromState(
func newTimeoutOverrides(key shim.TimeoutKey, maybeTimeoutSeconds float64) map[shim.TimeoutKey]time.Duration {
timeoutOverrides := map[shim.TimeoutKey]time.Duration{}
if maybeTimeoutSeconds != 0 {
timeoutOverrides[shim.TimeoutCreate] = time.Duration(maybeTimeoutSeconds * float64(time.Second))
timeoutOverrides[key] = time.Duration(maybeTimeoutSeconds * float64(time.Second))
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we have a lint for unused function args? That would have caught this.

Copy link
Member

@iwahbe iwahbe Mar 11, 2024

Choose a reason for hiding this comment

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

😢

issues:
exclude:
- "unused-parameter: parameter"

Copy link
Member

Choose a reason for hiding this comment

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

I opened #1750.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice.

}
switch tc.cud {
case "Update", "Delete":
return "TODO[pulumi/pulumi-terraform-bridge#1651] - schema-specified timeouts are not " +
Copy link
Member

Choose a reason for hiding this comment

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

Unless we can find a reason why they are not respected, let's respect them.

This is less Chesterton's fence then a pile of scattered sticks in a field.

@t0yv0 t0yv0 merged commit 54802d5 into master Mar 11, 2024
9 checks passed
@t0yv0 t0yv0 deleted the t0yv0/fix-update-custom-timeout branch March 11, 2024 19:17
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

3 participants