Bug 6120: Fix intermittent failures in BmpMonitorImplTest 05/41805/1
authorTom Pantelis <tpanteli@brocade.com>
Thu, 14 Jul 2016 04:54:08 +0000 (00:54 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 14 Jul 2016 06:48:38 +0000 (02:48 -0400)
commitef301dc8ad240e08f1e0cd9d8dc2232fd0073500
treeb60f6508bf024eb31d9450115399cd281fde4de3
parent723517d1eff3d7c01182691ddd8f02b0261e19b8
Bug 6120: Fix intermittent failures in BmpMonitorImplTest

There are many places where the tests perform an action, sleep 500 ms,
and read the data store to verify expected data was written as a result
of the action. However sometimes on jenkins 500 ms isn't enough.

https://git.opendaylight.org/gerrit/#/c/41764/ made changes to properly
wait for ChannelFutures to complete via a listener but I don't think that will
fix all the internittent failures since the prior code also waited for
the futures to complete. Also the hardcoded 500 ms sleeps prior to reading the
data store are still in place and it's still possible for a data store write to
not complete prior to reading it. So I eliminated the sleeps and changed it to
read and verify in a loop for up to 10 sec. After a read, if a verify assertion
fails, it sleeps a bit and reads again. This also speeds up the tests as, most of
the time, the data is written in much less than 500 ms.

After these changes the BmpMonitorImplTest ran 100 times successfully.

Change-Id: I4ab16fb063b03088cc3d1ec7623ec6f4e97242b8
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
bgp/bmp-impl/src/test/java/org/opendaylight/protocol/bmp/impl/app/BmpMonitorImplTest.java