Skip to content

Commit 2a4b0b3

Browse files
committed
Mock cloud_config() tests
1 parent 86aaca5 commit 2a4b0b3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/tests.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ test_type("list", ssh_config("ssh://remotehost"))
4343
test_type("list", ssh_config("ssh://remotehost", tunnel = TRUE))
4444
test_type("list", cluster_config())
4545
test_error(cloud_config(platform = ""), "not supported")
46-
test_error(cloud_config(platform = "posit"), "can only be used from Posit Workbench")
46+
if (is.null(mirai:::posit_tools())) {
47+
test_error(cloud_config(platform = "posit"), "can only be used from Posit Workbench")
48+
ns <- new.env(parent = emptyenv())
49+
`[[<-`(ns, ".rs.api.launcher.jobsFeatureAvailable", function() TRUE)
50+
`[[<-`(ns, ".rs.api.launcher.getInfo", function() list(clusters = list(list(name = "Kubernetes", defaultImage = "1.a.b.reg.prov.com/int-r-sess:ubuntu2204-20250609"))))
51+
attach(ns, name = "tools:rstudio")
52+
}
53+
test_type("list", cloud_config(platform = "posit"))
4754
test_true(is_mirai_interrupt(r <- mirai:::mk_interrupt_error()))
4855
test_print(r)
4956
test_true(is_mirai_error(r <- `class<-`("Error in: testing\n", c("miraiError", "errorValue", "try-error"))))

0 commit comments

Comments
 (0)