Skip to content

Commit 6663574

Browse files
committed
Mock cloud_config() tests
1 parent d7b9366 commit 6663574

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

0 commit comments

Comments
 (0)