kou commented on code in PR #43601:
URL: https://github.com/apache/arrow/pull/43601#discussion_r1769210314
##########
cpp/src/arrow/filesystem/s3fs_test.cc:
##########
@@ -1579,5 +1612,21 @@ TEST(S3GlobalOptions, DefaultsLogLevel) {
}
}
+TEST(CalculateSSECustomerKeyMD5, Sanity) {
+ ASSERT_RAISES(Invalid, CalculateSSECustomerKeyMD5("")); // invalid length
+ ASSERT_RAISES(Invalid,
+ CalculateSSECustomerKeyMD5(
+ "1234567890123456789012345678901234567890")); // invalid
length
+ // valid case, with some non-ASCII character and a null byte in the
sse_customer_key
+ char sse_customer_key[32] = {};
+ sse_customer_key[0] = '\x40'; // '@' character
+ sse_customer_key[1] = '\0'; // null byte
+ sse_customer_key[2] = '\xFF'; // non-ASCII
+ sse_customer_key[31] = '\xFA'; // non-ASCII
+ std::string sse_customer_key_string(sse_customer_key,
sizeof(sse_customer_key));
+ ASSERT_OK_AND_ASSIGN(auto md5,
CalculateSSECustomerKeyMD5(sse_customer_key_string))
+ ASSERT_STREQ(md5.c_str(), "97FTa6lj0hE7lshKdBy61g=="); // valid case
Review Comment:
```suggestion
ASSERT_EQ(md5, "97FTa6lj0hE7lshKdBy61g=="); // valid case
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]