liuml07 commented on a change in pull request #1840: HADOOP-16853. ITestS3GuardOutOfBandOperations failing on versioned S3 buckets URL: https://github.com/apache/hadoop/pull/1840#discussion_r378422262
########## File path: hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3GuardOutOfBandOperations.java ########## @@ -969,16 +970,42 @@ private void deleteFileInListing() deleteFile(rawFS, testFilePath); // File status will be still readable from s3guard - FileStatus status = guardedFs.getFileStatus(testFilePath); + S3AFileStatus status = (S3AFileStatus) + guardedFs.getFileStatus(testFilePath); LOG.info("authoritative: {} status: {}", allowAuthoritative, status); - expectExceptionWhenReading(testFilePath, text); - expectExceptionWhenReadingOpenFileAPI(testFilePath, text, null); - expectExceptionWhenReadingOpenFileAPI(testFilePath, text, status); + if (isVersionedChangeDetection() && status.getVersionId() != null) { + // when the status entry has a version ID, then that may be used + // when opening the file on what is clearly a versioned store. + int length = text.length(); + byte[] bytes = readOpenFileAPI(guardedFs, testFilePath, length, null); + Assertions.assertThat(toChar(bytes)) + .describedAs("openFile(%s)", testFilePath) + .isEqualTo(text); + // reading the rawFS with status will also work. + bytes = readOpenFileAPI(rawFS, testFilePath, length, status); Review comment: > bytes = readOpenFileAPI(rawFS, testFilePath, length, null); The file was deleted and I was expecting FNF exception here. I have not tested here with versioned bucket. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org