7676import static org .apache .hadoop .test .LambdaTestUtils .eventually ;
7777import static org .apache .hadoop .test .LambdaTestUtils .intercept ;
7878
79+ import static org .apache .hadoop .test .LambdaTestUtils .interceptFuture ;
7980import static org .junit .Assume .assumeTrue ;
8081import static org .mockito .Mockito .mock ;
8182import static org .mockito .Mockito .when ;
@@ -964,6 +965,14 @@ public void testListingDelete() throws Exception {
964965 // Delete the file without S3Guard (raw)
965966 deleteFile (rawFS , testFilePath );
966967
968+ // now, versioned FS or not, it will not be readable from the
969+ // raw FS, and this will fail in both open APIs during the open
970+ // phase, rather than when a read is attempted.
971+ interceptFuture (FileNotFoundException .class , "" ,
972+ rawFS .openFile (testFilePath ).build ());
973+ intercept (FileNotFoundException .class , () ->
974+ rawFS .open (testFilePath ).close ());
975+
967976 // File status will be still readable from s3guard
968977 S3AFileStatus status = (S3AFileStatus )
969978 guardedFs .getFileStatus (testFilePath );
@@ -985,8 +994,6 @@ public void testListingDelete() throws Exception {
985994 Assertions .assertThat (toChar (bytes ))
986995 .describedAs ("open(%s)" , testFilePath )
987996 .isEqualTo (text );
988- expectExceptionWhenReadingOpenFileAPI (rawFS , testFilePath , text ,
989- null );
990997 } else {
991998 // unversioned sequence
992999 expectExceptionWhenReading (testFilePath , text );
0 commit comments