amoeba commented on code in PR #34524:
URL: https://github.com/apache/arrow/pull/34524#discussion_r1142802326
##########
r/tests/testthat/test-gcs.R:
##########
@@ -91,6 +91,26 @@ test_that("GcsFileSystem$create() input validation", {
)
})
+test_that("GcsFileSystem$create() can read json_credentials", {
+ # From string
+ fs <- GcsFileSystem$create(json_credentials = "fromstring")
+ expect_equal(fs$options$json_credentials, "fromstring")
+
+ # From disk
+ cred_path <- tempfile()
+ on.exit(unlink(cred_path))
+ con <- file(cred_path, open = "wb")
+ writeBin('{"key" : "valu\u00e9"}', con)
+ close(con)
+
+ # This calls readLines which complains about embedded nuls and missing a
+ # final newline (See ?readLines)
+ suppressWarnings({
Review Comment:
Thanks for this. I tried a few combinations that still used readLines and
couldn't get something I liked that also passes CI. Even after ensuring the the
test file has the exact UTF-8 bytes I want, `readLines(path, encoding =
"UTF-8")` seems to still decode as Latin1. I stopped short of using a
connection or mutating options. I can't reproduce this on my own Windows VM so
testing solutions in CI is slow.
I ended up swapping out readLines for your above `read_utf8` helper and
previously updated the docs to indicate that the file must be UTF-8 encoded.
I'll check CI later tonight/tomorrow.
--
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]