boB Rudis
7 years ago
13 changed files with 100 additions and 43 deletions
@ -0,0 +1,9 @@ |
|||
try_require <- function(package, fun) { |
|||
if (requireNamespace(package, quietly = TRUE)) { |
|||
library(package, character.only = TRUE) |
|||
return(invisible()) |
|||
} |
|||
|
|||
stop("Package `", package, "` required for `", fun , "`.\n", # nocov start |
|||
"Please install and try again.", call. = FALSE) # nocov end |
|||
} |
@ -0,0 +1 @@ |
|||
comment: false |
@ -1,16 +1,67 @@ |
|||
context("basic functionality") |
|||
context("dplyr") |
|||
test_that("we can do something", { |
|||
|
|||
testthat::skip_on_cran() |
|||
# testthat::skip_on_travis() |
|||
testthat::skip_on_cran() |
|||
|
|||
src_drill("localhost") %>% |
|||
tbl("cp.`employee.json`") -> test_dplyr |
|||
db <- src_drill("localhost") |
|||
|
|||
drill_connection("localhost") %>% |
|||
drill_query("SELECT * FROM cp.`employee.json` limit 10") -> test_rest |
|||
expect_that(db, is_a("src_drill")) |
|||
|
|||
expect_that(sql_translate_env(db$con), is_a("sql_variant")) |
|||
|
|||
test_dplyr <- tbl(db, "cp.`employee.json`") |
|||
|
|||
expect_that(test_dplyr, is_a("tbl")) |
|||
expect_that(count(test_dplyr, gender), is_a("tbl")) |
|||
|
|||
}) |
|||
|
|||
context("rest") |
|||
test_that("we can do something", { |
|||
|
|||
testthat::skip_on_cran() |
|||
|
|||
dc <- drill_connection("localhost") |
|||
expect_that(drill_active(dc), equals(TRUE)) |
|||
|
|||
test_rest <- drill_query(dc, "SELECT * FROM cp.`employee.json` limit 10") |
|||
|
|||
expect_that(test_rest, is_a("data.frame")) |
|||
|
|||
expect_that(drill_version(dc), is_a("character")) |
|||
expect_that(drill_metrics(dc), is_a("list")) |
|||
expect_that(drill_options(dc), is_a("tbl")) |
|||
|
|||
dp <- drill_profiles(dc) |
|||
|
|||
expect_that(dp, is_a("list")) |
|||
expect_that(drill_profile(dc, dp$finishedQueries[1]$queryId[1]), is_a("list")) |
|||
expect_that(drill_cancel(dc, dp$finishedQueries[1]$queryId[1]), equals(TRUE)) |
|||
expect_that(drill_show_files(dc, schema_spec = "dfs"), is_a("tbl")) |
|||
expect_that(drill_show_schemas(dc), is_a("tbl")) |
|||
expect_that(drill_storage(dc), is_a("tbl")) |
|||
expect_that(drill_stats(dc), is_a("list")) |
|||
expect_that(drill_status(dc), is_a("html")) |
|||
expect_that(drill_threads(dc), is_a("html")) |
|||
expect_that(drill_use(dc, "cp"), is_a("tbl")) |
|||
expect_that(drill_set(dc, exec.errors.verbose=TRUE, |
|||
store.format="parquet", |
|||
q = 4, |
|||
web.logs.max_lines=20000), is_a("tbl")) |
|||
|
|||
|
|||
}) |
|||
|
|||
context("jdbc") |
|||
test_that("we can do something", { |
|||
|
|||
testthat::skip_on_cran() |
|||
|
|||
dc <- drill_jdbc("localhost:31010", use_zk=FALSE) |
|||
|
|||
expect_that(dc, is_a("JDBCConnection")) |
|||
|
|||
expect_that(drill_query(dc, "SELECT * FROM cp.`employee.json`"), |
|||
is_a("tbl")) |
|||
|
|||
}) |
|||
|
Loading…
Reference in new issue