/**
* Verify that goroutines waiting on a depleted pool get served when a returning object fails
* validation.
*
* JIRA: POOL-240
*
 */
Verify that goroutines waiting on a depleted pool get served when a returning object fails
validation.


/ ** * Verify that goroutines waiting on a depleted pool get served when a returning object fails * validation . * * JIRA : POOL - 240 * * /
func (suit *PoolTestSuite) TestValidationFailureOnReturnFreesCapacity() {
	suit.factory.setValid(false) 
	suit.factory.enableValidation = true
	suit.pool.Config.MaxTotal = 2
	suit.pool.Config.MaxWaitMillis = int64(1500)
	suit.pool.Config.TestOnReturn = true
	suit.pool.Config.TestOnBorrow = false
	ch1 := waitTestGoroutine(suit.pool, 5000)
	ch2 := waitTestGoroutine(suit.pool, 500)
	sleep(50)
	obj := suit.NoErrorWithResult(suit.pool.BorrowObject())
	suit.NoError(suit.pool.ReturnObject(obj))
	<-ch1
	close(ch1)
	<-ch2
	close(ch2)
}
func ( suit * PoolTestSuite ) TestValidationFailureOnReturnFreesCapacity ( ) { suit . factory . setValid ( false ) suit . factory . enableValidation = true suit . pool . Config . MaxTotal = 2 suit . pool . Config . MaxWaitMillis = int64 ( 1500 ) suit . pool . Config . TestOnReturn = true suit . pool . Config . TestOnBorrow = false ch1 := waitTestGoroutine ( suit . pool , 5000 ) ch2 := waitTestGoroutine ( suit . pool , 500 ) sleep ( 50 ) obj := suit . NoErrorWithResult ( suit . pool . BorrowObject ( ) ) suit . NoError ( suit . pool . ReturnObject ( obj ) ) <- ch1 close ( ch1 ) <- ch2 close ( ch2 ) }
Verify that goroutines waiting on a depleted pool get served when a returning object fails
validation.
Verify that goroutines waiting on a depleted pool get served when a returning object fails validation .
// Validate will always fail // Borrow an instance and hold if for 5 seconds // Borrow another instance and return it after 500 ms (validation will fail) // Try to borrow an object