Skip to content

Commit

Permalink
Fixes to run MinIO server on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Noam Ross committed Nov 14, 2023
1 parent c7e3e2a commit bd7ff62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Suggests:
knitr,
lintr,
minioclient,
paws,
rmarkdown,
spelling,
targets,
Expand Down
6 changes: 5 additions & 1 deletion R/example_repo.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ create_example_repo <- function(dir = fs::file_temp("relic_example_"), reporter
if(s3) {
insert_lines_at(
"_targets.R", 2,
'Sys.setenv(AWS_ACCESS_KEY_ID="minioadmin", AWS_SECRET_ACCESS_KEY="minioadmin")
'Sys.setenv(
AWS_ACCESS_KEY_ID="minioadmin",
AWS_SECRET_ACCESS_KEY="minioadmin",
AWS_DEFAULT_REGION="us-east-1"
)
tar_option_set(
resources = tar_resources(
aws = tar_resources_aws(
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ if(nzchar(Sys.getenv("RELIC_TEST_S3"))) {
s3_dir <- file_temp("s3_cache")
dir_create(s3_dir)

# Set minioclient directory to package directory so it is cached with packages
mc_dir <- file.path(find.package("minioclient"), "mc_bin")
dir_create(mc_dir)
# Set minioclient directory to package directory so it is cached with packages
withr::local_options(list(minioclient.dir = mc_dir))
options(minioclient.dir = mc_dir)
withr::local_options(list(minioclient.dir = mc_dir, minioserver.dir = mc_dir))
minioclient::install_mc()
minioclient::install_minio_server()
message("Installed MinIO server and client")

# Launch server
s3_srv <- minioclient::minio_server(dir = s3_dir, process_args = list(stdout = "minio.log", stderr = "2>&1"))
Sys.sleep(2)
stopifnot(s3_srv$is_alive())
message("Started background MinIO server")

## Create a bucket for testing
minioclient::mc_alias_set("relic", "localhost:9000", "minioadmin", "minioadmin", scheme = "http")
minioclient::mc_mb("relic/relic-test")
Expand Down

0 comments on commit bd7ff62

Please sign in to comment.