From db8c2cee076d33c9770295c1cfc7298cef1e3681 Mon Sep 17 00:00:00 2001 From: Anthony Sena Date: Tue, 19 Dec 2023 18:48:36 -0500 Subject: [PATCH] Restore RedShift unit tests (#109) * Update DatabaseConnector ref in test module; provide env var for test module location --- .github/workflows/R_CMD_check_Hades.yaml | 2 +- R/ModuleInstantiation.R | 6 -- extras/TestModule1-0.0.1/renv.lock | 9 ++- inst/testdata/TestModule1_0.0.1.zip | Bin 34332 -> 34353 bytes tests/testthat/setup.R | 74 ++++++++++++----------- tests/testthat/test-Strategus.R | 4 +- 6 files changed, 50 insertions(+), 45 deletions(-) diff --git a/.github/workflows/R_CMD_check_Hades.yaml b/.github/workflows/R_CMD_check_Hades.yaml index db1df5be..0ba1cc92 100644 --- a/.github/workflows/R_CMD_check_Hades.yaml +++ b/.github/workflows/R_CMD_check_Hades.yaml @@ -24,7 +24,7 @@ jobs: - {os: macOS-latest, r: '4.2.3', rtools: '42', rspm: "https://cloud.r-project.org"} - {os: ubuntu-20.04, r: '4.2.3', rtools: '42', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: windows-latest, r: 'release', rtools: '', rspm: "https://cloud.r-project.org"} - #- {os: macOS-latest, r: 'release', rtools: '', rspm: "https://cloud.r-project.org"} + - {os: macOS-latest, r: 'release', rtools: '', rspm: "https://cloud.r-project.org"} - {os: ubuntu-20.04, r: 'release', rtools: '', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} env: diff --git a/R/ModuleInstantiation.R b/R/ModuleInstantiation.R index 9db6724f..efb899af 100644 --- a/R/ModuleInstantiation.R +++ b/R/ModuleInstantiation.R @@ -418,12 +418,6 @@ instantiateModule <- function(module, version, remoteRepo, remoteUsername, modul withModuleRenv( code = { - ParallelLogger::addDefaultFileLogger( - fileName = file.path(moduleFolder, "moduleInitLog.txt") - ) - ParallelLogger::addDefaultErrorReportLogger( - fileName = file.path(moduleFolder, "moduleInitErrorReport.txt") - ) renv::restore(prompt = FALSE) }, moduleFolder = moduleFolder, diff --git a/extras/TestModule1-0.0.1/renv.lock b/extras/TestModule1-0.0.1/renv.lock index 00368cf8..695281fd 100644 --- a/extras/TestModule1-0.0.1/renv.lock +++ b/extras/TestModule1-0.0.1/renv.lock @@ -52,7 +52,7 @@ }, "DatabaseConnector": { "Package": "DatabaseConnector", - "Version": "6.2.3", + "Version": "6.3.2", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -185,7 +185,7 @@ }, "SqlRender": { "Package": "SqlRender", - "Version": "1.15.1", + "Version": "1.16.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -513,6 +513,11 @@ ], "Hash": "a4269a09a9b865579b2635c77e572374" }, + "keyring": { + "Package": "keyring", + "Version": "1.3.2", + "Source": "Repository" + }, "later": { "Package": "later", "Version": "1.3.0", diff --git a/inst/testdata/TestModule1_0.0.1.zip b/inst/testdata/TestModule1_0.0.1.zip index 1e599a73f1a7f5f95cf58daca8a82c8f46b37198..661f4c42d1c26a5aa9b1b7735a128d07d6d6b17d 100644 GIT binary patch delta 4476 zcmYM2WmwhQ*2O6)0cim#rBk{?knV12kl1WOy8a;Dv1v9SNH=V1lhWOSaOeiHIBWN$#&jeTsZWn~G+ zXw{|Wh%ZVz%%1FVWoZr8^0IN~0p-`6$?X!*+bF*DsfprdxcAlLY1ybX{OR%jS~0w% zi_W+k`cygAXyQxx`gj9#`}lKp=jHa&(oDzU@u{fS{M6dw`?%WBVQ9prlPSJV zuKVHIQ``l(yXuRazPi3q1G^uM%?IVGMrCR*8b9@e&rj(^NSc4__geeV924u>F0}#A zmESer`+GFpUxa1et~Up@#Jv{3e*YY_wqT{}HwgIYgMp3O1*4dUzWx_`!J%gJS;s1G zLq6#iUBYREy_^oFSFB$PsP_H}23!1Gm22&~+2p@++eI7tK%T` z(p+pmlI1hM*-XLNy$-sq=cyg)`EX~#rS;6{`mo46i4gh`P^WtSIR zNo*@h=Yu;&!t?IK$y76=#l;ZWsxix3rDDq}rHX=x24%6IQ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 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -13,33 +13,37 @@ withr::defer( testthat::teardown_env() ) -if (Sys.getenv("DONT_DOWNLOAD_JDBC_DRIVERS", "") != "TRUE") { - oldJarFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER") - Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = tempfile("jdbcDrivers")) - dir.create(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")) - - if (testthat::is_testing()) { - withr::defer({ - unlink(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"), recursive = TRUE, force = TRUE) - Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = oldJarFolder) +if (dir.exists(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"))) { + jdbcDriverFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER") +} else { + jdbcDriverFolder <- "~/jdbcDrivers" + dir.create(jdbcDriverFolder, showWarnings = FALSE) + baseDatabaseConnectorJarFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER") + Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = jdbcDriverFolder) + withr::defer( + { + unlink(jdbcDriverFolder, recursive = TRUE, force = TRUE) + Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = baseDatabaseConnectorJarFolder) }, testthat::teardown_env() - ) - } + ) } # Create a unique ID for the table identifiers tableSuffix <- paste0(substr(.Platform$OS.type, 1, 3), format(Sys.time(), "%y%m%d%H%M%S"), sample(1:100, 1)) tableSuffix <- abs(digest::digest2int(tableSuffix)) -tempDir <- tempfile() +usingTempDir <- Sys.getenv("STRATEGUS_UNIT_TEST_FOLDER") == "" +tempDir <- ifelse(usingTempDir, tempfile(), Sys.getenv("STRATEGUS_UNIT_TEST_FOLDER")) tempDir <- gsub("\\\\", "/", tempDir) # Correct windows path renvCachePath <- file.path(tempDir, "strategus/renv") moduleFolder <- file.path(tempDir, "strategus/modules") Sys.setenv("INSTANTIATED_MODULES_FOLDER" = moduleFolder) withr::defer( { - unlink(c(tempDir, renvCachePath, moduleFolder), recursive = TRUE, force = TRUE) + if (usingTempDir) { + unlink(c(tempDir, renvCachePath, moduleFolder), recursive = TRUE, force = TRUE) + } }, testthat::teardown_env() ) @@ -125,28 +129,28 @@ if (!(Sys.getenv("CDM5_ORACLE_USER") == "" & } # RedShift -# if (!(Sys.getenv("CDM5_REDSHIFT_USER") == "" & -# Sys.getenv("CDM5_REDSHIFT_PASSWORD") == "" & -# Sys.getenv("CDM5_REDSHIFT_SERVER") == "" & -# Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA") == "" & -# Sys.getenv("CDM5_REDSHIFT_OHDSI_SCHEMA") == "")) { -# DatabaseConnector::downloadJdbcDrivers("redshift") -# connectionDetailsList[[length(connectionDetailsList) + 1]] <- list( -# connectionDetails = DatabaseConnector::createConnectionDetails( -# dbms = "redshift", -# user = Sys.getenv("CDM5_REDSHIFT_USER"), -# password = URLdecode(Sys.getenv("CDM5_REDSHIFT_PASSWORD")), -# server = Sys.getenv("CDM5_REDSHIFT_SERVER"), -# port = 5439, -# pathToDriver = Sys.getenv("DATABASECONNECTOR_JAR_FOLDER") -# ), -# cdmDatabaseSchema = Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"), -# workDatabaseSchema = Sys.getenv("CDM5_REDSHIFT_OHDSI_SCHEMA"), -# vocabularyDatabaseSchema = Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"), -# cohortTable = "cohort", -# tempEmulationSchema = NULL -# ) -# } +if (!(Sys.getenv("CDM5_REDSHIFT_USER") == "" & + Sys.getenv("CDM5_REDSHIFT_PASSWORD") == "" & + Sys.getenv("CDM5_REDSHIFT_SERVER") == "" & + Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA") == "" & + Sys.getenv("CDM5_REDSHIFT_OHDSI_SCHEMA") == "")) { + DatabaseConnector::downloadJdbcDrivers("redshift") + connectionDetailsList[[length(connectionDetailsList) + 1]] <- list( + connectionDetails = DatabaseConnector::createConnectionDetails( + dbms = "redshift", + user = Sys.getenv("CDM5_REDSHIFT_USER"), + password = URLdecode(Sys.getenv("CDM5_REDSHIFT_PASSWORD")), + server = Sys.getenv("CDM5_REDSHIFT_SERVER"), + port = 5439, + pathToDriver = Sys.getenv("DATABASECONNECTOR_JAR_FOLDER") + ), + cdmDatabaseSchema = Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"), + workDatabaseSchema = Sys.getenv("CDM5_REDSHIFT_OHDSI_SCHEMA"), + vocabularyDatabaseSchema = Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"), + cohortTable = "cohort", + tempEmulationSchema = NULL + ) +} # SQL Server if (!(Sys.getenv("CDM5_SQL_SERVER_USER") == "" & diff --git a/tests/testthat/test-Strategus.R b/tests/testthat/test-Strategus.R index 312637d3..ecfbfd70 100644 --- a/tests/testthat/test-Strategus.R +++ b/tests/testthat/test-Strategus.R @@ -15,7 +15,9 @@ test_that("Run unit test study", { withr::defer( { - unlink(file.path(tempDir, "EunomiaTestStudy"), recursive = TRUE, force = TRUE) + if (usingTempDir) { + unlink(file.path(tempDir, "EunomiaTestStudy"), recursive = TRUE, force = TRUE) + } }, testthat::teardown_env() )