context("Package Command Line Tests")
test_that("getJobPackageInstallationCommand_Cran_Success", {
jobInstallation <-
getJobPackageInstallationCommand("cran", c("hts", "lubridate", "tidyr", "dplyr"))
expect_equal(
jobInstallation,
"Rscript $AZ_BATCH_JOB_PREP_WORKING_DIR/install_cran.R hts lubridate tidyr dplyr"
)
})
test_that("getJobPackageInstallationCommand_Github_Success", {
jobInstallation <-
getJobPackageInstallationCommand("github", c("Azure/doAzureParallel", "Azure/rAzureBatch"))
expect_equal(
jobInstallation,
"Rscript $AZ_BATCH_JOB_PREP_WORKING_DIR/install_github.R Azure/doAzureParallel Azure/rAzureBatch"
)
})
test_that("getPoolPackageInstallationCommand_Cran_Success", {
poolInstallation <-
getPoolPackageInstallationCommand("cran", c("hts", "lubridate", "tidyr"))
expect_equal(length(poolInstallation), 1)
libPathCommand <-
paste(
"Rscript -e \'args <- commandArgs(TRUE)\' -e 'options(warn=2)'",
"-e \'.libPaths( c( \\\"/mnt/batch/tasks/shared/R/packages\\\", .libPaths()));"
)
expected <-
c(
paste(libPathCommand, "install.packages(args)\' hts lubridate tidyr")
)
expect_equal(poolInstallation, expected)
})
test_that("getPoolPackageInstallationCommand_Github_Success", {
poolInstallation <-
getPoolPackageInstallationCommand("github", c("Azure/doAzureParallel", "Azure/rAzureBatch"))
expect_equal(length(poolInstallation), 1)
libPathCommand <-
paste(
"Rscript -e \'args <- commandArgs(TRUE)\' -e 'options(warn=2)'",
"-e \'.libPaths( c( \\\"/mnt/batch/tasks/shared/R/packages\\\", .libPaths()));"
)
expected <-
c(
paste(libPathCommand, "devtools::install_github(args)\' Azure/doAzureParallel Azure/rAzureBatch")
)
expect_equal(poolInstallation, expected)
})
test_that("getPoolPackageInstallationCommand_Bioconductor_Success", {
poolInstallation <-
getPoolPackageInstallationCommand("bioconductor", c("IRanges", "a4"))
expected <-
c(
paste("Rscript /mnt/batch/tasks/startup/wd/install_bioconductor.R",
"IRanges",
"a4",
sep = " ")
)
expect_equal(poolInstallation, expected)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.