-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add eqc trim tests to machi_file_proxy #35
Conversation
9b02096
to
b45dba9
Compare
b45dba9
to
8ce7441
Compare
@@ -58,68 +58,110 @@ | |||
count=0 :: non_neg_integer() | |||
}). | |||
|
|||
%% @doc official error types that is specific in Machi | |||
-type error_atoms() :: bad_arg | wedged | bad_checksum | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems some built-in types are defined in singular, e.g. atom()
, term()
, boolean()
. Which is better...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think singular is better, too.
(I guess And then,
|
trim_args(S) -> | ||
%% {Offset, Length} = hd(S#state.planned_trims), | ||
%% [S#state.pid, Offset, Length]. | ||
[S#state.pid, offset(), len()]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
offset()
returns small positive integers which probably inside 1024-byte header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in f560372.
* Add description on high client APIs * Add notes to rethink high client specification
b1579e9
to
3f6f9e2
Compare
Making testing time to 600 sec, following errors happened.
|
Changed a parameter to make more contention between Then got an error (longer version [2]):
[1] https://gist.github.com/shino/7e77c2fac3af4e3a7c85 |
It looks file_proxy is behaving correctly. I think the verification is wrong. |
Self comment to the above diff. It uses shorter intervals and makes each intervals filled. It will be useful to generate overlapped |
I think @kuenishi is right - the proxy is behaving correctly and the eqc test is not validating this case properly. |
file_proxy returns |
%% as a special case if we get a call to write the EXACT | ||
%% same data that's already on the disk, we return "ok" | ||
%% instead of {error, written}. | ||
mostly_true -> probably_error(Res); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably_error/1
is not used.
Test passed for several runs, diff looks nice 👍 |
Comments outside of this RP, just for future note, not mandatory for this PR to be merged.
|
Add eqc trim tests to machi_file_proxy
@shino "Are filenames in PB high clients string()?" I would like to keep file names as |
@slfritchie May I ask you a question, why use different types? |
Hrm, well, all of the library code is assuming a binary(). But the PB definition file uses "string", which the PB compiler converts to & from list()/string(). Since our conversation a week (?) or so ago in the office about valid char types for filenames, using a |
QuickCheck took me to the maze of my code.