@@ -579,6 +579,7 @@ public void testExistingFileTrash() throws IOException {
579
579
conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
580
580
FileSystem fs = FileSystem .getLocal (conf );
581
581
conf .set ("fs.defaultFS" , fs .getUri ().toString ());
582
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
582
583
conf .setLong (FS_TRASH_INTERVAL_KEY , 0 ); // disabled
583
584
assertFalse (new Trash (conf ).isEnabled ());
584
585
@@ -635,6 +636,7 @@ public void testNonDefaultFS() throws IOException {
635
636
Configuration conf = new Configuration ();
636
637
conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
637
638
conf .set ("fs.defaultFS" , "invalid://host/bar/foo" );
639
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
638
640
trashNonDefaultFS (conf );
639
641
}
640
642
@@ -644,6 +646,7 @@ public void testPluggableTrash() throws IOException {
644
646
645
647
// Test plugged TrashPolicy
646
648
conf .setClass ("fs.trash.classname" , TestTrashPolicy .class , TrashPolicy .class );
649
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
647
650
Trash trash = new Trash (conf );
648
651
assertTrue (trash .getTrashPolicy ().getClass ().equals (TestTrashPolicy .class ));
649
652
}
@@ -675,6 +678,7 @@ public void testMoveEmptyDirToTrash() throws Exception {
675
678
RawLocalFileSystem .class ,
676
679
FileSystem .class );
677
680
conf .setLong (FS_TRASH_INTERVAL_KEY , 1 ); // 1 min
681
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
678
682
FileSystem fs = FileSystem .get (conf );
679
683
verifyMoveEmptyDirToTrash (fs , conf );
680
684
}
@@ -692,6 +696,7 @@ public void testTrashRestarts() throws Exception {
692
696
TrashPolicy .class );
693
697
conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
694
698
conf .set (FS_TRASH_INTERVAL_KEY , "50" ); // in milliseconds for test
699
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
695
700
Trash trash = new Trash (conf );
696
701
// create 5 checkpoints
697
702
for (int i =0 ; i <5 ; i ++) {
@@ -720,6 +725,7 @@ public void testTrashPermission() throws IOException {
720
725
TrashPolicy .class );
721
726
conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
722
727
conf .set (FS_TRASH_INTERVAL_KEY , "0.2" );
728
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
723
729
verifyTrashPermission (FileSystem .getLocal (conf ), conf );
724
730
}
725
731
@@ -732,6 +738,7 @@ public void testTrashEmptier() throws Exception {
732
738
conf .set (FS_TRASH_CHECKPOINT_INTERVAL_KEY , "0.1" ); // 6 seconds
733
739
FileSystem fs = FileSystem .getLocal (conf );
734
740
conf .set ("fs.default.name" , fs .getUri ().toString ());
741
+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
735
742
736
743
Trash trash = new Trash (conf );
737
744
0 commit comments