Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Apr 8, 2024
1 parent c1c5084 commit ee424b3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
15 changes: 15 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,19 @@
library(testthat)
library(duckdbfs)

mc_config_get <- function(alias="play"){

# this can fail tp parse on windows, stdout is not pure json
# p <- minioclient::mc_alias_ls(paste(alias, "--json"))
# config <- jsonlite::fromJSON(p$stdout)

path <- getOption("minioclient.dir", tools::R_user_dir("minioclient", "data"))
json <- jsonlite::read_json(file.path(path, "config.json"))
config <- json$aliases[[alias]]
config$alias <- alias
config$URL <- config$url
config
}


test_check("duckdbfs")
14 changes: 5 additions & 9 deletions tests/testthat/test-write_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,16 @@ test_that("write_dataset to s3:", {
skip_if_not_installed("jsonlite")
skip_if_not_installed("minioclient")
minioclient::install_mc(force = TRUE)
p <- minioclient::mc_alias_ls("play --json")

# this fails on windows, stdout is not pure json
# config <- jsonlite::fromJSON(p$stdout)

path <- getOption("minioclient.dir", tools::R_user_dir("minioclient", "data"))
json <- jsonlite::read_json(file.path(path, "config.json"))
config <- json$aliases[["play"]]
config <- mc_config_get("play")

minioclient::mc_mb("play/duckdbfs")
mtcars |> group_by(cyl, gear) |>
mtcars |> dplyr::group_by(cyl, gear) |>
write_dataset(
"s3://duckdbfs/mtcars.parquet",
s3_access_key_id = config$accessKey,
s3_secret_access_key = config$secretKey,
s3_endpoint = config$URL,
s3_endpoint = config$url,
s3_use_ssl=TRUE,
s3_url_style="path"
)
Expand All @@ -100,3 +94,5 @@ test_that("write_dataset to s3:", {
minioclient::mc("rb --force play/duckdbfs")

})


0 comments on commit ee424b3

Please sign in to comment.