From f94c2f58252b481d6f0b143c771f5bfef57e853f Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Fri, 16 Oct 2026 13:56:51 +0100 Subject: [PATCH 1/2] fix: Run the tests that deploy to Connect only when asked test-check.R and test-sanitise.R skipped only on CI, so devtools::test() on a laptop deployed to whatever CONNECT_SERVER was set. They now need AUDIT_CONNECT_LIVE=true, and write their config to a temporary directory rather than tests/testthat. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BEZ4ZUv51gFQjAe1WePbJF --- README.Rmd | 10 ++++++++++ README.md | 10 ++++++++++ tests/testthat/helper-live.R | 7 +++++++ tests/testthat/test-check.R | 9 +++++---- tests/testthat/test-sanitise.R | 7 ++++--- 5 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 tests/testthat/helper-live.R 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( From 8c4ade9afbf2fc0aff4de94a6f221891713b924c Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Fri, 16 Oct 2026 13:56:51 +0100 Subject: [PATCH 2/2] chore: Bump version to 0.8.7 --- DESCRIPTION | 2 +- NEWS.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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