@@ -579,6 +579,7 @@ public void testExistingFileTrash() throws IOException {
579579 conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
580580 FileSystem fs = FileSystem .getLocal (conf );
581581 conf .set ("fs.defaultFS" , fs .getUri ().toString ());
582+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
582583 conf .setLong (FS_TRASH_INTERVAL_KEY , 0 ); // disabled
583584 assertFalse (new Trash (conf ).isEnabled ());
584585
@@ -635,6 +636,7 @@ public void testNonDefaultFS() throws IOException {
635636 Configuration conf = new Configuration ();
636637 conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
637638 conf .set ("fs.defaultFS" , "invalid://host/bar/foo" );
639+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
638640 trashNonDefaultFS (conf );
639641 }
640642
@@ -644,6 +646,7 @@ public void testPluggableTrash() throws IOException {
644646
645647 // Test plugged TrashPolicy
646648 conf .setClass ("fs.trash.classname" , TestTrashPolicy .class , TrashPolicy .class );
649+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
647650 Trash trash = new Trash (conf );
648651 assertTrue (trash .getTrashPolicy ().getClass ().equals (TestTrashPolicy .class ));
649652 }
@@ -675,6 +678,7 @@ public void testMoveEmptyDirToTrash() throws Exception {
675678 RawLocalFileSystem .class ,
676679 FileSystem .class );
677680 conf .setLong (FS_TRASH_INTERVAL_KEY , 1 ); // 1 min
681+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
678682 FileSystem fs = FileSystem .get (conf );
679683 verifyMoveEmptyDirToTrash (fs , conf );
680684 }
@@ -692,6 +696,7 @@ public void testTrashRestarts() throws Exception {
692696 TrashPolicy .class );
693697 conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
694698 conf .set (FS_TRASH_INTERVAL_KEY , "50" ); // in milliseconds for test
699+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
695700 Trash trash = new Trash (conf );
696701 // create 5 checkpoints
697702 for (int i =0 ; i <5 ; i ++) {
@@ -720,6 +725,7 @@ public void testTrashPermission() throws IOException {
720725 TrashPolicy .class );
721726 conf .setClass ("fs.file.impl" , TestLFS .class , FileSystem .class );
722727 conf .set (FS_TRASH_INTERVAL_KEY , "0.2" );
728+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
723729 verifyTrashPermission (FileSystem .getLocal (conf ), conf );
724730 }
725731
@@ -732,6 +738,7 @@ public void testTrashEmptier() throws Exception {
732738 conf .set (FS_TRASH_CHECKPOINT_INTERVAL_KEY , "0.1" ); // 6 seconds
733739 FileSystem fs = FileSystem .getLocal (conf );
734740 conf .set ("fs.default.name" , fs .getUri ().toString ());
741+ conf .setBoolean (FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY , true );
735742
736743 Trash trash = new Trash (conf );
737744
0 commit comments