Commit a19ca55
committed
Add unit-test for lease held by another entity scenario
Check that we enter this scenario and act properly by exceeding max retries and having failed manitenance event. Before the fix the obtainLease function always returned (false, err) for any error, including AlreadyHeldError. In the reconciler, the condition err != nil && updateOwnedLeaseFailed was never true, so ErrorOnLeaseCount was never incremented — it was actually reset to 0 in the fallthrough if err != nil block. Now obtainLease function returns (true, err) specifically for AlreadyHeldError, so ErrorOnLeaseCount properly increments on each reconcile. After 4 iterations (> 3), the node is uncordoned and maintenance transitions to Failed.1 parent d8b7eed commit a19ca55
2 files changed
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
263 | 294 | | |
264 | 295 | | |
265 | 296 | | |
| |||
413 | 444 | | |
414 | 445 | | |
415 | 446 | | |
| 447 | + | |
416 | 448 | | |
417 | 449 | | |
418 | 450 | | |
419 | | - | |
| 451 | + | |
420 | 452 | | |
0 commit comments