sending err back to fetch to trigger backoff retry#2136
Conversation
tvoran
left a comment
There was a problem hiding this comment.
This is looking pretty good to me, just some minor suggestions in the test.
Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
|
|
||
| func TestVaultRenewDuration(t *testing.T) { | ||
| renewable := Secret{LeaseDuration: 100, Renewable: true} | ||
| renewableDur := leaseCheckWait(&renewable).Seconds() |
There was a problem hiding this comment.
I'm curious why the .Seconds() was dropped here? That seems to have forced a lot of changes unrelated to the goal of this PR that I'm not sure are necessary?
At this point I'd say either set this back to .Seconds(), or apply the suggestions I made to the rest of TestVaultRenewDuration():
There was a problem hiding this comment.
.Seconds() dropped because now the leaseCheckWait is returning multiple values not just duration but also error. updated with your suggestions to the rest of TestVaultRenewDuration():
tvoran
left a comment
There was a problem hiding this comment.
Minor suggestion in the test, but otherwise 👍
| renewableDur := leaseCheckWait(&renewable).Seconds() | ||
| if renewableDur < 16 || renewableDur >= 34 { | ||
| t.Fatalf("renewable duration is not within 1/6 to 1/3 of lease duration: %f", renewableDur) | ||
| renewableDur, _ := leaseCheckWait(&renewable) |
There was a problem hiding this comment.
It's probably still a good idea to check the value of err whenever leaseCheckWait() is called, just to be safe.
issue: When a rotating secret that has rotation_period but ttl=0, it should not be treated as a rotating secret. Instead, it should wait and retry exponentially using default retry_config
What Changed:
Fixes: VAULT-38829-https://hashicorp.atlassian.net/browse/VAULT-38829?
before this change: checking to rotate every second
tested by adding custom retry config in agent.hcl
after the code change : Exponential backoff: 250ms,500ms,1s,2s, 4s, 8s, 16s, 32s, 64s, the max is 5m