basho/riak_pipe — pull request #65 by beerriot (2013-01-21 13:12:49+00:00)
Title: Quickchecking riak_pipe_fitting

This PR includes a quickcheck property for `riak_pipe_fitting`, as well as a fix for a small bug it found.

The `riak_pipe_fitting_eqc:prop_eoi/0` property is an attempt to test `riak_pipe_fitting`'s behavior during `eoi` propagation. The test sets up a fitting process, then starts zero or more [fake] vnodes, then maybe sends eoi to the fitting, then starts zero or more additional vnodes. All vnodes that receive a `#fitting_details{}` reply from the fitting are expected to also receive `eoi` messages from the fitting. The sink should also receive an `eoi`.

The bug had to do with wether the fitting was still up before `gen_fsm` calls were made against it. We were already catching `noproc` exits, which is what happened when the fitting was down before the call. In testing, `normal` exits were also encountered when the fitting was up before the the call, but then exited before replying. The patch catches all exits now.

The property can be run by `eqc:quickcheck(riak_pipe_fitting_eqc:prop_eoi())` or `eqc:module(riak_pipe_fitting_eqc)`, or by `rebar qc` if you have a new enough rebar. An eunit hook should be added before merge.