Ashutosh Mestry created ATLAS-2037:
--------------------------------------
Summary: Unit Test Failure:
NotificationHookConsumerTest.testConsumersAreStoppedWhenInstanceBecomesPassive
Key: ATLAS-2037
URL: https://issues.apache.org/jira/browse/ATLAS-2037
Project: Atlas
Issue Type: Bug
Components: atlas-core
Affects Versions: trunk
Reporter: Ashutosh Mestry
Assignee: Ashutosh Mestry
Priority: Minor
Fix For: trunk, 0.8.1-incubating
*Analysis*
- The test has few mocks, but we don’t mock _HookConsumer_ (derived from
_ShutdownableThread_). Hence, the object needs be in line with its usage
pattern.
- The _ShutdownableThread_ has a _CountdownLatch_ that is checked during
shutdown.
In the test, the _HookConsumer_ was not being started at all. This caused
_shutdownLatch_ (of type _CountdownLatch_) not to decrement, since no work was
performed, but anticipating work is going to be done. The test thus ended up
not getting completed, since the thread was in perpetual wait.
*Solution*
The _HookConsumer_ should be used such that it is started and shutdown. So the
test passes.
_HookConsumer_ should check for _shouldRun_ in _shutdown_ method, so that the
case where _shutdown_ is called without _start_ is handled.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)