Skip to content

Commit 53bf680

Browse files
committed
tests: skip few failing on full disk tests
1 parent dd633fb commit 53bf680

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

t/tasks/maintenance.t

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use FusionInventory::Agent::Task::Maintenance;
1717
use FusionInventory::Agent::Target::Local;
1818
use FusionInventory::Agent::Target::Server;
1919
use FusionInventory::Agent::Target::Scheduler;
20+
use FusionInventory::Agent::Task::Deploy::Datastore;
2021

2122
plan tests => 22;
2223

@@ -91,21 +92,31 @@ lives_ok {
9192

9293
# Test Deploy maintenance module
9394
my $folder = $scheduler->getStorage()->getDirectory().'/deploy/fileparts/private';
94-
my @files = map { $folder.'/'.$_.'/test' } (0,time-60,time+3600);
95-
foreach my $file (@files) {
96-
File::Path::mkpath(dirname($file));
97-
open FILE, ">$file" or die "Can't create tmp file: $!\n";
98-
print FILE "TEST\n";
99-
close(FILE);
95+
SKIP: {
96+
my $datastore = FusionInventory::Agent::Task::Deploy::Datastore->new(
97+
config => {},
98+
path => $scheduler->getStorage()->getDirectory(),
99+
logger => $logger
100+
);
101+
skip 'disk is still full', 7
102+
if $datastore->diskIsFull();
103+
104+
my @files = map { $folder.'/'.$_.'/test' } (0,time-60,time+3600);
105+
foreach my $file (@files) {
106+
File::Path::mkpath(dirname($file));
107+
open FILE, ">$file" or die "Can't create tmp file: $!\n";
108+
print FILE "TEST\n";
109+
close(FILE);
110+
}
111+
ok( -f $files[0], "File exists in folder 0");
112+
ok( -f $files[1], "File exists in past folder");
113+
ok( -f $files[2], "File exists in future folder");
114+
115+
lives_ok {
116+
$task->run();
117+
} "Doing Deploy maintenance";
118+
119+
ok( ! -f $files[0], "File removed in folder 0");
120+
ok( ! -f $files[1], "File removed in past folder");
121+
ok( -f $files[2], "File exists in future folder");
100122
}
101-
ok( -f $files[0], "File exists in folder 0");
102-
ok( -f $files[1], "File exists in past folder");
103-
ok( -f $files[2], "File exists in future folder");
104-
105-
lives_ok {
106-
$task->run();
107-
} "Doing Deploy maintenance";
108-
109-
ok( ! -f $files[0], "File removed in folder 0");
110-
ok( ! -f $files[1], "File removed in past folder");
111-
ok( -f $files[2], "File exists in future folder");

0 commit comments

Comments
 (0)