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 ee424b3 commit 139ec96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
12 changes: 0 additions & 12 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,7 @@
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")
18 changes: 17 additions & 1 deletion tests/testthat/test-write_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ test_that("write_dataset to s3:", {
skip_if_not_installed("minioclient")
minioclient::install_mc(force = TRUE)

config <- mc_config_get("play")
p <- minioclient::mc_alias_ls(paste(alias, "--json"))
config <- jsonlite::fromJSON(p$stdout)

minioclient::mc_mb("play/duckdbfs")
mtcars |> dplyr::group_by(cyl, gear) |>
Expand All @@ -95,4 +96,19 @@ test_that("write_dataset to s3:", {

})

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)

## fails to find config on remote
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
}


0 comments on commit 139ec96

Please sign in to comment.