Skip to content

Commit d68f8f6

Browse files
committed
Generalized ping test config
1 parent 462fc3c commit d68f8f6

3 files changed

Lines changed: 20 additions & 22 deletions

File tree

tests/testthat/connection_to_datasets/init_local_settings.R

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ init.server.url <- function()
1010
file.name <- init.local.settings()
1111
if (file.exists(file.name))
1212
{
13-
content <- read.csv(file.name, header = FALSE)
14-
server_ping.url <- as.character(content[[1]][1])
15-
server_ping.url <- as.character(content[[1]][2])
13+
content <- read.csv(file.name, header = FALSE)
14+
server.url <- as.character(content[[1]][1])
1615
}
1716
else
1817
{
19-
server.url <- NULL
20-
server_ping.url <- NULL
18+
server.url <- NULL
2119
}
2220
return (server.url)
2321
}
@@ -26,9 +24,9 @@ init.server.url <- function()
2624

2725
init.local.settings <- function()
2826
{
29-
path <- getwd()
30-
sub.folder.name <- "/connection_to_datasets/"
31-
file.name <- "local_settings.csv"
27+
path <- getwd()
28+
sub.folder.name <- "/connection_to_datasets/"
29+
file.name <- "local_settings.csv"
3230

33-
return(paste(path, sub.folder.name, file.name, sep=""))
31+
return(paste(path, sub.folder.name, file.name, sep=""))
3432
}

tests/testthat/connection_to_datasets/login_details.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ if (! is.null(getOption("default_driver"))) {
2323

2424
if ((ds.test_env$driver == "DSLiteDriver") || (ds.test_env$driver == "OpalDriver")) {
2525
if (! is.null(ds.test_env$server_url)) {
26-
opal.url <- ds.test_env$server_url
27-
opal_ping.url <- ds.test_env$server_ping_url
26+
opal.url <- ds.test_env$server_url
2827
} else {
29-
opal.url <- "https://localhost:8443/"
30-
opal_ping.url <- "http://localhost:8080/"
28+
opal.url <- "https://localhost:8443/"
3129
}
3230

33-
ds.test_env$ping_url <- opal_ping.url
34-
ds.test_env$ping_config <- config(timeout=5)
31+
ds.test_env$ping_url <- opal.url
32+
ds.test_env$ping_user <- getOption("opal.user", "administrator")
33+
ds.test_env$ping_password <- getOption("opal.password", "datashield_test&")
34+
ds.test_env$ping_options <- config(timeout=5, ssl_verifyhost=0, ssl_verifypeer=0)
3535

3636
ds.test_env$server_url_1 <- opal.url
3737
ds.test_env$server_url_2 <- opal.url
@@ -52,15 +52,15 @@ if ((ds.test_env$driver == "DSLiteDriver") || (ds.test_env$driver == "OpalDriver
5252
ds.test_env$secure_login_details <- TRUE
5353
} else if (ds.test_env$driver == "ArmadilloDriver") {
5454
if (! is.null(ds.test_env$server_url)) {
55-
armadillo.url <- ds.test_env$server_url
56-
armadillo_ping.url <- ds.test_env$server_ping_url
55+
armadillo.url <- ds.test_env$server_url
5756
} else {
58-
armadillo.url <- "http://localhost:8080/"
59-
armadillo_ping.url <- "http://localhost:8080/"
57+
armadillo.url <- "http://localhost:8080/"
6058
}
6159

62-
ds.test_env$ping_url <- armadillo_ping.url
63-
ds.test_env$ping_config <- config(timeout=5)
60+
ds.test_env$ping_url <- armadillo_ping.url
61+
ds.test_env$ping_user <- getOption("armadillo.user", "admin")
62+
ds.test_env$ping_password <- getOption("armadillo.password", "admin")
63+
ds.test_env$ping_options <- "list(timeout=5)"
6464

6565
ds.test_env$server_url_1 <- armadillo.url
6666
ds.test_env$server_url_2 <- armadillo.url

tests/testthat/test-_-vm-test.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ init.testing.datasets()
2626

2727
test_that("The virtual machine is loaded. ",
2828
{
29-
response <- httr::HEAD(url=ds.test_env$ping_url, config=ds.test_env$ping_config)
29+
response <- httr::HEAD(url=ds.test_env$ping_url, config=ds.test_env$ping_options, authenticate(ds.test_env$ping_user, ds.test_env$ping_password))
3030
expect_true(http_status(response)$reason %in% c("OK", "Unauthorized"))
3131
})
3232

0 commit comments

Comments
 (0)