basho / riak_pipe

Riak Pipelines
Apache License 2.0
162 stars 60 forks source link

Quickchecking riak_pipe_fitting #65

Closed beerriot closed 11 years ago

beerriot commented 11 years ago

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.

coderoshi commented 11 years ago

All looks good +1