Subject: | t/import.t test fails if the hosts is heavily loaded |
If the host is not fast enough, the t/import.t test can file like this:
# Failed test at t/import.t line 17.
# '1402724184'
# <=
# '1402724180'
# Looks like you failed 1 test of 7.
t/import.t ...
Dubious, test returned 1 (wstat 256, 0x100)
Failed
This is causes by this code:
my $start = time;
cmp_ok($start, '>=', $otime + 10_000);
sleep(1);
my $end = time;
cmp_ok($end, '>=', $start + 1);
cmp_ok($end, '<=', $start + 2);
Obviously the last cmp_ok() will fail if running time is more than 2 time-mocked-seconds.
One should measure the non-mocked time, and skip the test if the non-mocked time exceeded 2/100 seconds.