tests/testthat/test-s3-select.R

test_that("s3 select api requests work and returns a data frame", {
  skip_on_os("windows")
  skip_if_offline()
  skip_on_cran()
  Sys.setenv("R_USER_DATA_DIR"=tempdir())
  install_mc()
  
  
  mc_mb("play/iris")
  tf <- tempfile(fileext = ".csv")
  write.csv(iris, row.names = FALSE, file = tf)
  mc_cp(tf, "play/iris/iris.csv")
  
  iris <- mc_sql("play/iris/iris.csv")
  
  is_valid <- nrow(iris) == 150 & ncol(iris) == 5
  
  expect_true(is_valid)
})

test_that("s3 select api requests work with a specific query used", {
  
  skip_on_os("windows")
  skip_if_offline()
  skip_on_cran()
  Sys.setenv("R_USER_DATA_DIR"=tempdir())
  
  install_mc()
  
  
  mc_mb("play/iris")
  tf <- tempfile(fileext = ".csv")
  write.csv(iris, row.names = FALSE, file = tf)
  mc_cp(tf, "play/iris/iris.csv")
  
  iris <- 
    mc_sql("play/iris/iris.csv",  query = 
      "select s.Species from S3Object s where s.Species = 'setosa' limit 6")
  
  is_valid <- nrow(iris) == 6
  
  expect_true(is_valid)
})

Try the minioclient package in your browser

Any scripts or data that you put into this service are public.

minioclient documentation built on Nov. 7, 2023, 5:07 p.m.