hibari / gdss-admin

http://hibari.github.com/hibari-doc/
Other
2 stars 0 forks source link

make_exp/1 in some test cases creates expiration time that will never expire in a test scenario #11

Open tatsuya6502 opened 8 years ago

tatsuya6502 commented 8 years ago

The following test modules have make_exp/1 function:

It first looked like make_exp/1 returns a key-value expiration time expiring in given milli-seconds. But I think it's creating expiration time that is 10^6 times bigger than the intended value.

-spec make_exp(non_neg_integer()) -> exp_time().
make_exp(StepMillis) ->
    {MSec, Sec, USec} = now(),
    NowX = (MSec * 1000000 * 1000000) + (Sec * 1000000) + USec,
    (NowX * 1000) + StepMillis.

NowX is in micro-seconds and a key-value expiration time is in milli-seconds. So (NowX * 1000) should read (NowX div 1000) to achieve micro to milli-seconds conversion.

Also, those eqc test models do not have conditions to handle expired key-values. They need to be added before make_exp/1 is corrected.