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

Fix eunit failures #360

Merged
merged 16 commits into from
Aug 10, 2012
Merged

Fix eunit failures #360

merged 16 commits into from
Aug 10, 2012

Conversation

seancribbs
Copy link
Contributor

This fixes a bunch of failures and setup problems in riak_kv's eunit/EQC suite. It is currently passing on Travis.

@ghost ghost assigned seancribbs Jul 3, 2012
@rzezeski
Copy link
Contributor

rzezeski commented Jul 5, 2012

I haven't reviewed the code but it did fix eunit failures.

@ghost ghost assigned rzezeski Jul 26, 2012


do_dep_apps(StartStop, Apps) ->
lists:map(fun(A) when is_atom(A) -> application:StartStop(A);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application:unload/1 has been known to do strange things in the past. But, I think that may have been before we started running each app's eunits as a separate rebar invocation. If it passes all platforms now, we can return to its debugging when/if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my goal was to remove all application env entries for the app, and then load them fresh on the next run from the .app file. If unload doesn't do that, then it can easily be removed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, I must admit to cargo-culting (i.e. I'm not sure what else it does). @slfritchie has warned me off when I've snuck in calls to unload before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application:unload() can occasionally fail with an exception that cascades to the (IIRC) the application controller and then crashes the OTP kernel app, which then stops the VM. Tests interpret the VM shutting down as a failure, which I think is a good feature. I forget the details of how it works, but it does happen, at least with R14B04. I haven't tried risking the ire of R15B01.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slfritchie Is it only certain apps? I could understand why unloading kernel or stdlib would do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a pattern, but it wasn't a matter of unloading apps with sticky dirs like kernel. It can happen for any of the Riak dependency apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, i removed the unloading bit. Not having it doesn't seem to affect any of our existing tests.

@beerriot
Copy link

beerriot commented Aug 1, 2012

Running locally (OS X 10.8, Erlang R15B01), make test hangs during the setup of the riak_kv_delete tests. After adding debugging printouts, it appears to be stuck at riak_core:wait_for_application(riak_kv) in riak_kv_test_util:setup/2.

Sean Cribbs added 15 commits August 8, 2012 13:54
* New keys_fsm requires ack_keys when backpressure is turned on.
* Correct the startup order of applications based on reltool's computed list.
* Use the memory backend and its reset() function instead of deleting keys.
* Isolate the state directory of the test to .eunit/keys_fsm_eqc.
* Cleanup ring files in the state directory before the test instead of rejiggering the ring.
* Use a consistent node name and use longnames so that the put_fsm doesn't get confused.
* Wait for KV application and service to start rather than using an arbitrary sleep.
* Don't call application:unload/1.
* Don't start folsom since it is an included application of riak_core.
* Improve the documentation on new riak_kv_test_util functions.
@seancribbs
Copy link
Contributor Author

I have rebased this from the 1.2 branch. @beerriot @rzezeski I would appreciate a final review.

%% `CleanupFun' given to `cleanup/3'.
%%
%% @see common_setup/2, dep_apps/2, do_dep_apps/2
-spec setup(TestName::string(), fun((load|start|stop) -> any()) -> ok.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to put the TestName in the spec. Since sometime in release 14 edoc is smart enough to match specs and function arguments up automatically.

@rzezeski
Copy link
Contributor

Why not put riak_kv_test_util into the test dir?

Also, that module failed to compile for me:

/Users/rzezeski/tmp/riak_kv/src/riak_kv_test_util.erl:51: syntax error before: '->'
/Users/rzezeski/tmp/riak_kv/src/riak_kv_test_util.erl:150: syntax error before: '->'
/Users/rzezeski/tmp/riak_kv/src/riak_kv_test_util.erl:219: syntax error before: ':'

@rzezeski
Copy link
Contributor

The tests pass and based on the output seem to run more cleanly as well. Nice job @seancribbs.

+1 to merge.

@ghost ghost assigned seancribbs Aug 10, 2012
seancribbs pushed a commit that referenced this pull request Aug 10, 2012
@seancribbs seancribbs merged commit 530606f into master Aug 10, 2012
@seancribbs seancribbs removed their assignment May 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants