[ 
https://issues.apache.org/jira/browse/STORM-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14065460#comment-14065460
 ] 

Derek Dagit commented on STORM-413:
-----------------------------------

In STORM-403, we have a test that mocks out functions that launch and shut down 
workers, but as is explained, the mocking did not take effect for the correct 
scope, resulting in a test error:

https://github.com/apache/incubator-storm/pull/193#issuecomment-49348655


There is also a potential problem with a recent change upon shutting down a 
local cluster:

https://github.com/apache/incubator-storm/blob/ff345c1fa9dcbe55e96037bec3b59d06c3f64cd4/storm-core/src/clj/backtype/storm/testing.clj#L237-L240

The change ensures that the simulated cluster does not get stuck trying to shut 
down, but in doing so it also calls `advance-cluster-time` repeatedly.


For these kinds of tests, it might be good to remove the submitted topology, so 
that its worker is not unintentionally launched after the test body is 
evaluated.

Or, even better, if all we are trying to do is stub out the two functions to 
prevent actual launching of workers, we could wrap this entire test in a 
`mocking` call and thus be sure those methods will not be called even in shut 
down.

```Clojure
(deftest heartbeats-to-nimbus
  (mocking [supervisor/launch-worker supervisor/shutdown-worker]
    (with-simulated-time-local-cluster [cluster :supervisors 0
```

In this specific test, only mocking is desired, but this will not be a complete 
solution in other cases.


> Investigate Tests using Simulated Time and Mocking
> --------------------------------------------------
>
>                 Key: STORM-413
>                 URL: https://issues.apache.org/jira/browse/STORM-413
>             Project: Apache Storm (Incubating)
>          Issue Type: Bug
>    Affects Versions: 0.9.2-incubating
>            Reporter: Derek Dagit
>            Priority: Minor
>              Labels: testing
>
> Several issues with running storm's tests have arisen that are related to 
> timing and race conditions.
> Hang: STORM-200 
> (https://github.com/apache/incubator-storm/commit/573c42a64885dac9a6a0d4c69a754500b607a8f1)
> Unexpected Exception: STORM-403
> We should investigate tests that use simulated time while mocking out 
> functions to ensure that bindings are properly set where they need to be.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to