typester / Test-RedisServer

redis-server runner for testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid Assumption in t/tmp_dir.t

tomhukins opened this issue · comments

I've just seen a test failure in t/tmp_dir.t that I thought I should report.

The test counts the number of files in the temporary directory, starts and stops a Redis server, then counts the files again. It expects both counts to yield the same result.

However, other processes can write to the temporary directory, adding or removing files while the tests run. In this case, the test fails even though the code has behaved as it should.

commented

It seems the code confuses two tmp directories: a pretty private temp directory for the server and the system-wide temp directory. The latter, of course, may change the number of contained files all the time, but the test insists that the latter stays the same size.

my $tmp_root_dir = File::Spec->tmpdir();
my @initial_files = <$tmp_root_dir/>;
my $initial_children_count = @initial_files;
my @files = <$tmp_root_dir/
>;
is scalar @files, $initial_children_count, "no files remained after server shutdown";

At least my smoker quite often breaks this test because on my smoker there are plenty of parallel activities going on.

Sample fail report:

http://www.cpantesters.org/cpan/report/62675204