Don't test writing to a read-only directory

root can always write to a read-only directory so the test was failing
on the CI runners (which run as root).
This commit is contained in:
Richard Hansen 2020-07-08 15:36:45 -04:00
parent 192a00ad64
commit 173865bd75

View file

@ -15,10 +15,6 @@ $module->redefine('warning', sub {
my $tmpdir = File::Temp->newdir(); my $tmpdir = File::Temp->newdir();
my $dir = $tmpdir->dirname(); my $dir = $tmpdir->dirname();
diag("temporary directory: $dir"); diag("temporary directory: $dir");
my $ro_tmpdir = File::Temp->newdir();
my $ro_dir = $ro_tmpdir->dirname();
chmod(0500, $ro_dir) or BAIL_OUT($!);
diag("temporary read-only directory: $ro_dir");
sub tc { sub tc {
return { return {
@ -32,7 +28,7 @@ my @test_cases = (
tc("create cache file", catfile($dir, 'a', 'b', 'cachefile'), undef), tc("create cache file", catfile($dir, 'a', 'b', 'cachefile'), undef),
tc("overwrite cache file", catfile($dir, 'a', 'b', 'cachefile'), undef), tc("overwrite cache file", catfile($dir, 'a', 'b', 'cachefile'), undef),
tc("bad directory", catfile($dir, 'a', 'b', 'cachefile', 'bad'), qr/Failed to create/i), tc("bad directory", catfile($dir, 'a', 'b', 'cachefile', 'bad'), qr/Failed to create/i),
tc("read-only directory", catfile($ro_dir, 'cachefile'), qr/Failed to create/i), tc("bad file", catfile($dir, 'a', 'b'), qr/Failed to create/i),
); );
for my $tc (@test_cases) { for my $tc (@test_cases) {