HADOOP-16941. ITestS3GuardOutOfBandOperations.testListingDelete failing on versioned bucket (#1919)

Contributed by Steve Loughran.

Removed the failing probe and replacing with two probes which will fail
on both versioned and unversioned buckets.
This commit is contained in:
Steve Loughran 2020-04-14 10:56:00 +01:00
parent b397a3a875
commit 68a9562848
1 changed files with 9 additions and 2 deletions

View File

@ -76,6 +76,7 @@ import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides
import static org.apache.hadoop.test.LambdaTestUtils.eventually; import static org.apache.hadoop.test.LambdaTestUtils.eventually;
import static org.apache.hadoop.test.LambdaTestUtils.intercept; import static org.apache.hadoop.test.LambdaTestUtils.intercept;
import static org.apache.hadoop.test.LambdaTestUtils.interceptFuture;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -964,6 +965,14 @@ public class ITestS3GuardOutOfBandOperations extends AbstractS3ATestBase {
// Delete the file without S3Guard (raw) // Delete the file without S3Guard (raw)
deleteFile(rawFS, testFilePath); deleteFile(rawFS, testFilePath);
// now, versioned FS or not, it will not be readable from the
// raw FS, and this will fail in both open APIs during the open
// phase, rather than when a read is attempted.
interceptFuture(FileNotFoundException.class, "",
rawFS.openFile(testFilePath).build());
intercept(FileNotFoundException.class, () ->
rawFS.open(testFilePath).close());
// File status will be still readable from s3guard // File status will be still readable from s3guard
S3AFileStatus status = (S3AFileStatus) S3AFileStatus status = (S3AFileStatus)
guardedFs.getFileStatus(testFilePath); guardedFs.getFileStatus(testFilePath);
@ -985,8 +994,6 @@ public class ITestS3GuardOutOfBandOperations extends AbstractS3ATestBase {
Assertions.assertThat(toChar(bytes)) Assertions.assertThat(toChar(bytes))
.describedAs("open(%s)", testFilePath) .describedAs("open(%s)", testFilePath)
.isEqualTo(text); .isEqualTo(text);
expectExceptionWhenReadingOpenFileAPI(rawFS, testFilePath, text,
null);
} else { } else {
// unversioned sequence // unversioned sequence
expectExceptionWhenReading(testFilePath, text); expectExceptionWhenReading(testFilePath, text);