@@ -17,6 +17,7 @@ use FusionInventory::Agent::Task::Maintenance;
1717use FusionInventory::Agent::Target::Local;
1818use FusionInventory::Agent::Target::Server;
1919use FusionInventory::Agent::Target::Scheduler;
20+ use FusionInventory::Agent::Task::Deploy::Datastore;
2021
2122plan tests => 22;
2223
@@ -91,21 +92,31 @@ lives_ok {
9192
9293# Test Deploy maintenance module
9394my $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