From 096737741c4d6f1f367d3eea6e16f979f9265da9 Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Fri, 4 Oct 2024 13:27:38 -0700 Subject: [PATCH] run rds create db test only if running with specific env var - #74 --- Makefile | 2 +- tests/testthat/helper-funs.R | 4 ++++ tests/testthat/test-db-rds.R | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8f398d6..b54ff1e 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ vign_db: cd .. test: - ${RSCRIPT} -e "devtools::test()" + SIXTYFOUR_RUN_LOCAL_ONLY_TESTS=true ${RSCRIPT} -e "devtools::test()" readme: ${RSCRIPT} -e "knitr::knit('README.Rmd')" diff --git a/tests/testthat/helper-funs.R b/tests/testthat/helper-funs.R index b14c18a..6132413 100644 --- a/tests/testthat/helper-funs.R +++ b/tests/testthat/helper-funs.R @@ -12,3 +12,7 @@ random_string <- function(prefix, size = 8) { "{prefix}{paste0(sample(letters, size = size), collapse = '')}" ) } + +running_local_only_tests <- function() { + as.logical(Sys.getenv("SIXTYFOUR_RUN_LOCAL_ONLY_TESTS", FALSE)) +} diff --git a/tests/testthat/test-db-rds.R b/tests/testthat/test-db-rds.R index 0fb4aeb..fd9fe17 100644 --- a/tests/testthat/test-db-rds.R +++ b/tests/testthat/test-db-rds.R @@ -1,5 +1,6 @@ test_that("aws_db_rds_create", { skip_on_ci() + skip_if_not(running_local_only_tests()) vcr::use_cassette("aws_db_rds_create", { z <- aws_db_rds_create( id = "bananas2", class = "db.t3.micro",