Skip to content

Commit

Permalink
Re-enable all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonysena committed Dec 19, 2023
1 parent 79e1839 commit e4b6fe4
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 84 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/R_CMD_check_Hades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
fail-fast: false
matrix:
config:
#- {os: windows-latest, r: '4.2.3', rtools: '42', rspm: "https://cloud.r-project.org"}
#- {os: macOS-latest, r: '4.2.3', rtools: '42', rspm: "https://cloud.r-project.org"}
- {os: windows-latest, r: '4.2.3', rtools: '42', rspm: "https://cloud.r-project.org"}
- {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: ubuntu-20.04, r: 'release', rtools: '', 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: ubuntu-20.04, r: 'release', rtools: '', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

env:
GITHUB_PAT: ${{ secrets.GH_TOKEN }}
Expand Down
153 changes: 74 additions & 79 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,81 +52,81 @@ withr::defer(
connectionDetailsList <- list()

# SQLite
# eunomiaDbFile <- file.path(tempDir, "data", "testEunomia.sqlite")
# if (!dir.exists(file.path(tempDir, "data"))) {
# dir.create(file.path(tempDir, "data"), recursive = T, showWarnings = F)
# }
# connectionDetails <- Eunomia::getEunomiaConnectionDetails(
# databaseFile = eunomiaDbFile
# )
# withr::defer(
# {
# unlink(eunomiaDbFile, recursive = TRUE, force = TRUE)
# },
# testthat::teardown_env()
# )
# cdmDatabaseSchema <- "main"
# workDatabaseSchema <- "main"
# vocabularyDatabaseSchema <- workDatabaseSchema
# cohortTable <- "cohort"
# tempEmulationSchema <- NULL
#
# connectionDetailsList[[length(connectionDetailsList) + 1]] <- list(
# connectionDetails = connectionDetails,
# cdmDatabaseSchema = "main",
# workDatabaseSchema = "main",
# vocabularyDatabaseSchema = "main",
# cohortTable = "cohort",
# tempEmulationSchema = NULL
# )
eunomiaDbFile <- file.path(tempDir, "data", "testEunomia.sqlite")
if (!dir.exists(file.path(tempDir, "data"))) {
dir.create(file.path(tempDir, "data"), recursive = T, showWarnings = F)
}
connectionDetails <- Eunomia::getEunomiaConnectionDetails(
databaseFile = eunomiaDbFile
)
withr::defer(
{
unlink(eunomiaDbFile, recursive = TRUE, force = TRUE)
},
testthat::teardown_env()
)
cdmDatabaseSchema <- "main"
workDatabaseSchema <- "main"
vocabularyDatabaseSchema <- workDatabaseSchema
cohortTable <- "cohort"
tempEmulationSchema <- NULL

# # PostgreSQL
# if (!(Sys.getenv("CDM5_POSTGRESQL_USER") == "" &
# Sys.getenv("CDM5_POSTGRESQL_PASSWORD") == "" &
# Sys.getenv("CDM5_POSTGRESQL_SERVER") == "" &
# Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA") == "" &
# Sys.getenv("CDM5_POSTGRESQL_OHDSI_SCHEMA") == "")) {
# DatabaseConnector::downloadJdbcDrivers("postgresql")
# connectionDetailsList[[length(connectionDetailsList) + 1]] <- list(
# connectionDetails = DatabaseConnector::createConnectionDetails(
# dbms = "postgresql",
# user = Sys.getenv("CDM5_POSTGRESQL_USER"),
# password = URLdecode(Sys.getenv("CDM5_POSTGRESQL_PASSWORD")),
# server = Sys.getenv("CDM5_POSTGRESQL_SERVER"),
# port = 5432,
# pathToDriver = Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
# ),
# cdmDatabaseSchema = Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA"),
# workDatabaseSchema = Sys.getenv("CDM5_POSTGRESQL_OHDSI_SCHEMA"),
# vocabularyDatabaseSchema = Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA"),
# cohortTable = "cohort",
# tempEmulationSchema = NULL
# )
# }
#
# # Oracle
# if (!(Sys.getenv("CDM5_ORACLE_USER") == "" &
# Sys.getenv("CDM5_ORACLE_PASSWORD") == "" &
# Sys.getenv("CDM5_ORACLE_SERVER") == "" &
# Sys.getenv("CDM5_ORACLE_CDM_SCHEMA") == "" &
# Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA") == "")) {
# DatabaseConnector::downloadJdbcDrivers("oracle")
# connectionDetailsList[[length(connectionDetailsList) + 1]] <- list(
# connectionDetails = DatabaseConnector::createConnectionDetails(
# dbms = "oracle",
# user = Sys.getenv("CDM5_ORACLE_USER"),
# password = URLdecode(Sys.getenv("CDM5_ORACLE_PASSWORD")),
# server = Sys.getenv("CDM5_ORACLE_SERVER"),
# port = 1521,
# pathToDriver = Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
# ),
# cdmDatabaseSchema = Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"),
# workDatabaseSchema = Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA"),
# vocabularyDatabaseSchema = Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"),
# cohortTable = "cohort",
# tempEmulationSchema = Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA")
# )
# }
connectionDetailsList[[length(connectionDetailsList) + 1]] <- list(
connectionDetails = connectionDetails,
cdmDatabaseSchema = "main",
workDatabaseSchema = "main",
vocabularyDatabaseSchema = "main",
cohortTable = "cohort",
tempEmulationSchema = NULL
)

# PostgreSQL
if (!(Sys.getenv("CDM5_POSTGRESQL_USER") == "" &
Sys.getenv("CDM5_POSTGRESQL_PASSWORD") == "" &
Sys.getenv("CDM5_POSTGRESQL_SERVER") == "" &
Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA") == "" &
Sys.getenv("CDM5_POSTGRESQL_OHDSI_SCHEMA") == "")) {
DatabaseConnector::downloadJdbcDrivers("postgresql")
connectionDetailsList[[length(connectionDetailsList) + 1]] <- list(
connectionDetails = DatabaseConnector::createConnectionDetails(
dbms = "postgresql",
user = Sys.getenv("CDM5_POSTGRESQL_USER"),
password = URLdecode(Sys.getenv("CDM5_POSTGRESQL_PASSWORD")),
server = Sys.getenv("CDM5_POSTGRESQL_SERVER"),
port = 5432,
pathToDriver = Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
),
cdmDatabaseSchema = Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA"),
workDatabaseSchema = Sys.getenv("CDM5_POSTGRESQL_OHDSI_SCHEMA"),
vocabularyDatabaseSchema = Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA"),
cohortTable = "cohort",
tempEmulationSchema = NULL
)
}

# Oracle
if (!(Sys.getenv("CDM5_ORACLE_USER") == "" &
Sys.getenv("CDM5_ORACLE_PASSWORD") == "" &
Sys.getenv("CDM5_ORACLE_SERVER") == "" &
Sys.getenv("CDM5_ORACLE_CDM_SCHEMA") == "" &
Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA") == "")) {
DatabaseConnector::downloadJdbcDrivers("oracle")
connectionDetailsList[[length(connectionDetailsList) + 1]] <- list(
connectionDetails = DatabaseConnector::createConnectionDetails(
dbms = "oracle",
user = Sys.getenv("CDM5_ORACLE_USER"),
password = URLdecode(Sys.getenv("CDM5_ORACLE_PASSWORD")),
server = Sys.getenv("CDM5_ORACLE_SERVER"),
port = 1521,
pathToDriver = Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
),
cdmDatabaseSchema = Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"),
workDatabaseSchema = Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA"),
vocabularyDatabaseSchema = Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"),
cohortTable = "cohort",
tempEmulationSchema = Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA")
)
}

# RedShift
if (!(Sys.getenv("CDM5_REDSHIFT_USER") == "" &
Expand All @@ -150,11 +150,6 @@ if (!(Sys.getenv("CDM5_REDSHIFT_USER") == "" &
cohortTable = "cohort",
tempEmulationSchema = NULL
)

# DEBUG:
print(dir(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")))
conn <- DatabaseConnector::connect(connectionDetails = connectionDetailsList[[length(connectionDetailsList)]]$connectionDetails)
DatabaseConnector::disconnect(conn)
}

# # SQL Server
Expand Down

0 comments on commit e4b6fe4

Please sign in to comment.