Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state/presence: cleanups for issue 1588574 #5530

Closed
wants to merge 1 commit into from
Closed

state/presence: cleanups for issue 1588574 #5530

wants to merge 1 commit into from

Commits on Jun 6, 2016

  1. state/presence: stop watchers/pingers before TearDownTest

    Fixes LP 1588574
    
    The `panic: session already closed` comes from a watcher or pinger that
    is still running when the test case returns to TearDownTest. This
    happens because while we always call w.Stop in a defer, w.Stop does not
    actually stop the worker, it just asks it to stop.
    
    To ensure the worker is stopped, introduce a new function `assertStopped`
    which stops a worker and waits until it reports stopped.  This method should
    be used in favor of defer w.Stop() because you _must_ ensure that all workers
    that share a mongo connection (which is _all_ of them) have stopped, and thus
    are no longer using a mgo session before `TearDownTest` shuts down the connection.
    
    Because this pattern of stopping and not waiting was common to both the
    pinter and watcher tests, and is now resolved, we can remove the
    `recover` in the `ping()` method.
    davecheney committed Jun 6, 2016
    Copy the full SHA
    dbc4245 View commit details
    Browse the repository at this point in the history