diff --git a/DESCRIPTION b/DESCRIPTION index 9c5fe63..26ee203 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: audit.connect Title: Posit Connect Health Check -Version: 0.8.6 +Version: 0.8.7 Authors@R: person("Jumping", "Rivers", , "info@jumpingrivers.com", role = c("aut", "cre")) Description: Posit Connect Health Check. Deploys various content types to diff --git a/NEWS.md b/NEWS.md index ed59889..e680557 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# audit.connect 0.8.7 + +## Bug fixes and minor improvements + +* The tests that deploy to `CONNECT_SERVER` only run when `AUDIT_CONNECT_LIVE` is `true`, so `devtools::test()` no longer deploys to whichever server is set (#68). + # audit.connect 0.8.6 ## Bug fixes and minor improvements diff --git a/README.Rmd b/README.Rmd index 89a898b..8d3f955 100644 --- a/README.Rmd +++ b/README.Rmd @@ -139,3 +139,13 @@ example_test = function() { return(TRUE) } ``` + +## Running the tests + +`test-check.R` and `test-sanitise.R` deploy test content to the server in `CONNECT_SERVER`, so they +are skipped unless `AUDIT_CONNECT_LIVE` is `true`: + +```r +Sys.setenv(AUDIT_CONNECT_LIVE = "true") +devtools::test() +``` diff --git a/README.md b/README.md index 56558e2..ff2b21a 100644 --- a/README.md +++ b/README.md @@ -134,3 +134,13 @@ example_test = function() { return(TRUE) } ``` + +## Running the tests + +`test-check.R` and `test-sanitise.R` deploy test content to the server in `CONNECT_SERVER`, so they +are skipped unless `AUDIT_CONNECT_LIVE` is `true`: + +```r +Sys.setenv(AUDIT_CONNECT_LIVE = "true") +devtools::test() +``` diff --git a/tests/testthat/helper-live.R b/tests/testthat/helper-live.R new file mode 100644 index 0000000..955fda0 --- /dev/null +++ b/tests/testthat/helper-live.R @@ -0,0 +1,7 @@ +# These tests deploy to CONNECT_SERVER, so they only run when asked +skip_if_not_live = function() { + testthat::skip_if_not( + identical(Sys.getenv("AUDIT_CONNECT_LIVE"), "true"), + "set AUDIT_CONNECT_LIVE=true to deploy to CONNECT_SERVER" + ) +} diff --git a/tests/testthat/test-check.R b/tests/testthat/test-check.R index b7bca3a..d598fd1 100644 --- a/tests/testthat/test-check.R +++ b/tests/testthat/test-check.R @@ -1,9 +1,10 @@ test_that("High level test", { - testthat::skip_on_ci() - create_config(default = TRUE) - expect_error(check(server = "aaa.bbb")) + skip_if_not_live() + dir = withr::local_tempdir() + create_config(dir = dir, default = TRUE) + expect_error(check(server = "aaa.bbb", dir = dir)) # Run standard check - rtn = suppressMessages(check()) + rtn = suppressMessages(check(dir = dir)) expect_true(is.list(rtn)) check_names = c( diff --git a/tests/testthat/test-sanitise.R b/tests/testthat/test-sanitise.R index 8ca5d5a..c9dec90 100644 --- a/tests/testthat/test-sanitise.R +++ b/tests/testthat/test-sanitise.R @@ -1,8 +1,9 @@ describe("Checking sanitize function", { - testthat::skip_on_ci() + skip_if_not_live() + dir = withr::local_tempdir() # Skip report checks for speed - create_config(default = FALSE, type = "force") - rtn = suppressMessages(check()) + create_config(dir = dir, default = FALSE, type = "force") + rtn = suppressMessages(check(dir = dir)) sanitize_rtn = sanitise(rtn) it(