Refreshing with an invalid session should work
I would like this test to pass, but it currently doesn't. With the current implementation, there is a race, if the session is locked, but releases before the "handleObtainLockError" starts, then you'll get an error, which is not desirable
This commit is contained in:
		
							parent
							
								
									1478fefe92
								
							
						
					
					
						commit
						327211cec9
					
				|  | @ -613,7 +613,7 @@ var _ = Describe("Stored Session Suite", func() { | ||||||
| 					ObtainError:       errors.New("not able to obtain lock"), | 					ObtainError:       errors.New("not able to obtain lock"), | ||||||
| 				}, | 				}, | ||||||
| 			}), | 			}), | ||||||
| 			Entry("when obtaining lock failed", refreshSessionIfNeededTableInput{ | 			Entry("when obtaining lock failed with a valid session", refreshSessionIfNeededTableInput{ | ||||||
| 				refreshPeriod: 1 * time.Minute, | 				refreshPeriod: 1 * time.Minute, | ||||||
| 				session: &sessionsapi.SessionState{ | 				session: &sessionsapi.SessionState{ | ||||||
| 					RefreshToken: noRefresh, | 					RefreshToken: noRefresh, | ||||||
|  | @ -630,6 +630,24 @@ var _ = Describe("Stored Session Suite", func() { | ||||||
| 					ObtainError: errors.New("not able to obtain lock"), | 					ObtainError: errors.New("not able to obtain lock"), | ||||||
| 				}, | 				}, | ||||||
| 			}), | 			}), | ||||||
|  | 			Entry("when obtaining lock failed with an invalid session", refreshSessionIfNeededTableInput{ | ||||||
|  | 				refreshPeriod: 1 * time.Minute, | ||||||
|  | 				session: &sessionsapi.SessionState{ | ||||||
|  | 					RefreshToken: noRefresh, | ||||||
|  | 					CreatedAt:    &createdPast, | ||||||
|  | 					ExpiresOn:    &createdPast, | ||||||
|  | 					Lock: &TestLock{ | ||||||
|  | 						ObtainError: errors.New("not able to obtain lock"), | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
|  | 				expectedErr:     nil, | ||||||
|  | 				expectRefreshed: true, | ||||||
|  | 				expectValidated: false, | ||||||
|  | 				expectedLockState: TestLock{ | ||||||
|  | 					PeekedCount: 2, | ||||||
|  | 					ObtainError: errors.New("not able to obtain lock"), | ||||||
|  | 				}, | ||||||
|  | 			}), | ||||||
| 			Entry("when the session is not refreshed by the provider", refreshSessionIfNeededTableInput{ | 			Entry("when the session is not refreshed by the provider", refreshSessionIfNeededTableInput{ | ||||||
| 				refreshPeriod: 1 * time.Minute, | 				refreshPeriod: 1 * time.Minute, | ||||||
| 				session: &sessionsapi.SessionState{ | 				session: &sessionsapi.SessionState{ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue