kou commented on code in PR #43601: URL: https://github.com/apache/arrow/pull/43601#discussion_r1768133916
########## cpp/src/arrow/filesystem/s3fs_test.cc: ########## @@ -1288,6 +1291,40 @@ TEST_F(TestS3FS, OpenInputFile) { ASSERT_RAISES(IOError, file->Seek(10)); } +TEST_F(TestS3FS, SSECustomerKeyMatch) { + // normal write/read with correct SSEC key + std::shared_ptr<io::OutputStream> stream; + options_.sse_customer_key = "12345678123456781234567812345678"; + MakeFileSystem(true); // need to use https, otherwise get 'InvalidRequest Message: + // Requests specifying Server Side Encryption with Customer + // provided keys must be made over a secure connection.' + ASSERT_OK_AND_ASSIGN(stream, fs_->OpenOutputStream("bucket/newfile_with_sse_c")); + ASSERT_OK(stream->Write("some")); + ASSERT_OK(stream->Close()); + std::shared_ptr<io::RandomAccessFile> file; + std::shared_ptr<Buffer> buf; + ASSERT_OK_AND_ASSIGN(file, fs_->OpenInputFile("bucket/newfile_with_sse_c")); + ASSERT_OK_AND_ASSIGN(buf, file->Read(4)); + AssertBufferEqual(*buf, "some"); + ASSERT_OK(RestoreTestBucket()); +} + +TEST_F(TestS3FS, SSECustomerKeyMismatch) { + std::shared_ptr<io::OutputStream> stream; + options_.sse_customer_key = "12345678123456781234567812345678"; + MakeFileSystem(true); + ASSERT_OK_AND_ASSIGN(stream, fs_->OpenOutputStream("bucket/newfile_with_sse_c")); + ASSERT_OK(stream->Write("some")); + ASSERT_OK(stream->Close()); + + options_.sse_customer_key = "87654321876543218765432187654321"; + MakeFileSystem(true); + std::shared_ptr<io::RandomAccessFile> file; + std::shared_ptr<Buffer> buf; Review Comment: Can we remove this? -- 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. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org