Commit Graph

11 Commits

Author SHA1 Message Date
Steven Clark
a47b44a18a
TestLifetimeWatcher: Address race condition in test assertions (#15969)
- If the timing is correct, a delay in the test's select might see the
   doneCh signal before the renew channels signal. If that happens, the
   test fails as it assumes we will receive signals across different
   channels in order.
 - Rework the test to make sure that we read from the renew channel if expected
   and the done channel so that any errors might not be escaping from detection
   on a renew.
2022-06-14 09:44:51 -04:00
Anton Averchenkov
9c6d25ad16
Respect increment value in grace period calculations (api/LifetimeWatcher) (#14836) 2022-04-06 13:04:45 -04:00
Nick Cabatoff
459e13f813
Fix LifetimeWatcher test using a buffered channel to ensure that we don't miss a renewal notice. (#14298) 2022-02-28 09:24:19 -05:00
Pratyoy Mukhopadhyay
7f875c94f0
[MAR-3131] Set grace to 0 on non-positive lease duration (#12372)
* [MAR-3131] Set grace to 0 on non-positive lease duration

* [MAR-3131] Add changelog

* [VAULT-3131] Add test for negative lease duration
2021-08-24 19:06:40 -07:00
Nick Cabatoff
b986083c55
LifetimeWatcher should retry renew failures until end of lease (#11445)
Co-authored-by: Andrej van der Zee <andrejvanderzee@gmail.com>
2021-05-06 14:04:26 -04:00
Jeff Mitchell
79ae63e9ae Sync up Agent and API's renewers. (#7733)
* Sync up Agent and API's renewers.

This introduces a new type, LifetimeWatcher, which can handle both
renewable and non-renewable secrets, modeled after the version in Agent.
It allows the user to select behavior, with the new style being the
default when calling Start(), and old style if using the legacy Renew()
call.

No tests have been modified (except for reflect issues) and no other
code has been modified to make sure the changes are backwards
compatible.

Once this is accepted I'll pull the Agent version out.

* Move compat flags to NewRenewer

* Port agent to shared lifetime watcher lib
2019-10-28 17:28:59 -07:00
Jeff Mitchell
545c8f13a1 Remove outdated renewer test 2018-05-09 12:33:20 -04:00
Jeff Mitchell
9ca558c303
Update lease renewer logic (#4090)
* Add grace period calculation logic to renewer

* Update lease renewer logic.

It is believed by myself and members of the Nomad team that this logic
should be much more robust in terms of causing large numbers of new
secret acquisitions caused by a static grace period. See comments in the
code for details.

Fixes #3414

* Fix some commenting and fix tests

* Add more time to test so that integ tests don't time out

* Fix some review feedback
2018-03-19 15:48:24 -04:00
Seth Vargo
8f97e9b04d
Fix failing test 2017-07-07 17:14:49 -04:00
Seth Vargo
47260ed024
Move renewer integration tests into separate package 2017-07-07 17:14:46 -04:00
Seth Vargo
dcbd729afa
Add secret renewer 2017-07-07 17:14:44 -04:00