tests/test-with-docker.R

if (Sys.getenv("SKIP_DB_TESTS") == "1") q()

library("dbtools")
library("testthat")

TEST <- function(topic, expr, envir = parent.frame()) {
  cat(paste0(topic, ":"))
  res <- try(
    eval(match.call()$expr, envir = new.env(parent = envir))
  )
  if (inherits(res, "try-error")) {
    stop(topic, ": -- F A I L E D --")
  } else {
    cat("OK\n")
  }
}

cat("Testing:\n")

RUN_TESTS <- function() {
  system("bash start-db.sh")
  on.exit(system("bash stop-db.sh"))
  testFiles <- list.files("test-with-docker.d", full.names = TRUE)
  for (file in testFiles) source(file, new.env())
}

RUN_TESTS()
INWT/dbtools documentation built on Aug. 21, 2022, 9:37 p.m.