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

Enchance/mw/bg manager #538

Closed
wants to merge 5 commits into from
Closed

Enchance/mw/bg manager #538

wants to merge 5 commits into from

Conversation

lordnull
Copy link
Contributor

Add tests for coverage of exported api, and removed unused/old code in the process.

The table is not given to the bg_manager. The supervising process
creates the tables named and public. The bg_manager always refers to
the tables by name, so there's waiting for a transfer.
The more similar the code used in test is to production, the better.
If the test needs to survive killing the manager, unlink can be used.
Most tests are there to ensure the external api remains consistent and
cover the interesting cases. This has boosted coverage from 60's to 90's.
This also caught incorrect specs for some return values.
@cmeiklejohn
Copy link
Contributor

Is this targeted for 2.0 or 2.1?

gen_server:call(?SERVER, {disable, Resource}).
case gen_server:call(?SERVER, {disable, Resource}) of
{unregistered, Resource} ->
unregistered;
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the benefit of changing the API here. I understand the information is redundant but is there a reason? Also, this code path seems repeated in many places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The spec did not match the actual return value. Looking at where this was used, it seemed the better option was to change the code so it matched the spec rather than the other way around. This was discovered while writing the unit test for the function.

Copy link
Contributor

Choose a reason for hiding this comment

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

hrm, neither dialyzer [1] nor the eqc test caught this. one should...once again, i'd like to move away from the unit tests (and see them removed once any non-redundant parts are part of the eqc test). the unit tests caused several problems along the way during review.

[1] https://github.com/basho/riak_core/pull/528/files#diff-9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double checking, this breaks the eqc, so fixing the spec would been the right way to go.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok wfm. i'm guessing btw that dialyzer can't figure it out bc of the gen_server message boundary.

@lordnull
Copy link
Contributor Author

This has been punted upon until at least 2.1.

@jrwest
Copy link
Contributor

jrwest commented Feb 28, 2014

related PR: #535

@jrwest
Copy link
Contributor

jrwest commented Mar 24, 2014

For now marking as milestone 2.0.1.

@lordnull can this be closed? some of these changes overlapped with other PRs and others, and iirc broke tests or were not necessary.

@jrwest jrwest added this to the 2.0.1 milestone Mar 24, 2014
@lordnull
Copy link
Contributor Author

This can be closed mainly since it ended up duplicating some effort.

@lordnull lordnull closed this Mar 26, 2014
@seancribbs seancribbs deleted the enchance/mw/bg-manager branch April 1, 2015 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants