Skip to content

Commit

Permalink
Switching testing to CDMv54
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin_mschuemi authored and Admin_mschuemi committed Sep 12, 2023
1 parent 85fabde commit abf23de
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/R_CMD_check_Hades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ jobs:
GITHUB_PAT: ${{ secrets.GH_TOKEN }}
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
CDM5_ORACLE_CDM_SCHEMA: ${{ secrets.CDM5_ORACLE_CDM_SCHEMA }}
CDM5_ORACLE_CDM54_SCHEMA: ${{ secrets.CDM5_ORACLE_CDM54_SCHEMA }}
CDM5_ORACLE_OHDSI_SCHEMA: ${{ secrets.CDM5_ORACLE_OHDSI_SCHEMA }}
CDM5_ORACLE_PASSWORD: ${{ secrets.CDM5_ORACLE_PASSWORD }}
CDM5_ORACLE_SERVER: ${{ secrets.CDM5_ORACLE_SERVER }}
CDM5_ORACLE_USER: ${{ secrets.CDM5_ORACLE_USER }}
CDM5_POSTGRESQL_CDM_SCHEMA: ${{ secrets.CDM5_POSTGRESQL_CDM_SCHEMA }}
CDM5_POSTGRESQL_CDM54_SCHEMA: ${{ secrets.CDM5_POSTGRESQL_CDM54_SCHEMA }}
CDM5_POSTGRESQL_OHDSI_SCHEMA: ${{ secrets.CDM5_POSTGRESQL_OHDSI_SCHEMA }}
CDM5_POSTGRESQL_PASSWORD: ${{ secrets.CDM5_POSTGRESQL_PASSWORD }}
CDM5_POSTGRESQL_SERVER: ${{ secrets.CDM5_POSTGRESQL_SERVER }}
CDM5_POSTGRESQL_USER: ${{ secrets.CDM5_POSTGRESQL_USER }}
CDM5_SQL_SERVER_CDM_SCHEMA: ${{ secrets.CDM5_SQL_SERVER_CDM_SCHEMA }}
CDM5_SQL_SERVER_CDM54_SCHEMA: ${{ secrets.CDM5_SQL_SERVER_CDM54_SCHEMA }}
CDM5_SQL_SERVER_OHDSI_SCHEMA: ${{ secrets.CDM5_SQL_SERVER_OHDSI_SCHEMA }}
CDM5_SQL_SERVER_PASSWORD: ${{ secrets.CDM5_SQL_SERVER_PASSWORD }}
CDM5_SQL_SERVER_SERVER: ${{ secrets.CDM5_SQL_SERVER_SERVER }}
CDM5_SQL_SERVER_USER: ${{ secrets.CDM5_SQL_SERVER_USER }}
CDM5_REDSHIFT_CDM_SCHEMA: ${{ secrets.CDM5_REDSHIFT_CDM_SCHEMA }}
CDM5_REDSHIFT_CDM54_SCHEMA: ${{ secrets.CDM5_REDSHIFT_CDM54_SCHEMA }}
CDM5_REDSHIFT_OHDSI_SCHEMA: ${{ secrets.CDM5_REDSHIFT_OHDSI_SCHEMA }}
CDM5_REDSHIFT_PASSWORD: ${{ secrets.CDM5_REDSHIFT_PASSWORD }}
CDM5_REDSHIFT_SERVER: ${{ secrets.CDM5_REDSHIFT_SERVER }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/R_CMD_check_main_weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ jobs:
GITHUB_PAT: ${{ secrets.GH_TOKEN }}
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
CDM5_ORACLE_CDM_SCHEMA: ${{ secrets.CDM5_ORACLE_CDM_SCHEMA }}
CDM5_ORACLE_CDM54_SCHEMA: ${{ secrets.CDM5_ORACLE_CDM54_SCHEMA }}
CDM5_ORACLE_OHDSI_SCHEMA: ${{ secrets.CDM5_ORACLE_OHDSI_SCHEMA }}
CDM5_ORACLE_PASSWORD: ${{ secrets.CDM5_ORACLE_PASSWORD }}
CDM5_ORACLE_SERVER: ${{ secrets.CDM5_ORACLE_SERVER }}
CDM5_ORACLE_USER: ${{ secrets.CDM5_ORACLE_USER }}
CDM5_POSTGRESQL_CDM_SCHEMA: ${{ secrets.CDM5_POSTGRESQL_CDM_SCHEMA }}
CDM5_POSTGRESQL_CDM54_SCHEMA: ${{ secrets.CDM5_POSTGRESQL_CDM54_SCHEMA }}
CDM5_POSTGRESQL_OHDSI_SCHEMA: ${{ secrets.CDM5_POSTGRESQL_OHDSI_SCHEMA }}
CDM5_POSTGRESQL_PASSWORD: ${{ secrets.CDM5_POSTGRESQL_PASSWORD }}
CDM5_POSTGRESQL_SERVER: ${{ secrets.CDM5_POSTGRESQL_SERVER }}
CDM5_POSTGRESQL_USER: ${{ secrets.CDM5_POSTGRESQL_USER }}
CDM5_SQL_SERVER_CDM_SCHEMA: ${{ secrets.CDM5_SQL_SERVER_CDM_SCHEMA }}
CDM5_SQL_SERVER_CDM54_SCHEMA: ${{ secrets.CDM5_SQL_SERVER_CDM54_SCHEMA }}
CDM5_SQL_SERVER_OHDSI_SCHEMA: ${{ secrets.CDM5_SQL_SERVER_OHDSI_SCHEMA }}
CDM5_SQL_SERVER_PASSWORD: ${{ secrets.CDM5_SQL_SERVER_PASSWORD }}
CDM5_SQL_SERVER_SERVER: ${{ secrets.CDM5_SQL_SERVER_SERVER }}
CDM5_SQL_SERVER_USER: ${{ secrets.CDM5_SQL_SERVER_USER }}
CDM5_REDSHIFT_CDM_SCHEMA: ${{ secrets.CDM5_REDSHIFT_CDM_SCHEMA }}
CDM5_REDSHIFT_CDM54_SCHEMA: ${{ secrets.CDM5_REDSHIFT_CDM54_SCHEMA }}
CDM5_REDSHIFT_OHDSI_SCHEMA: ${{ secrets.CDM5_REDSHIFT_OHDSI_SCHEMA }}
CDM5_REDSHIFT_PASSWORD: ${{ secrets.CDM5_REDSHIFT_PASSWORD }}
CDM5_REDSHIFT_SERVER: ${{ secrets.CDM5_REDSHIFT_SERVER }}
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-BatchProcess.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_that("renderTranslateQueryApplyBatched works", {
password = URLdecode(Sys.getenv("CDM5_ORACLE_PASSWORD")),
server = Sys.getenv("CDM5_ORACLE_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA")
sql <- "SELECT TOP 10 * FROM @cdm_database_schema.vocabulary;"
data <- renderTranslateQueryApplyBatched(connection,
sql,
Expand All @@ -52,7 +52,7 @@ test_that("renderTranslateQueryApplyBatched works", {
password = URLdecode(Sys.getenv("CDM5_SQL_SERVER_PASSWORD")),
server = Sys.getenv("CDM5_SQL_SERVER_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA")

sql <- "SELECT TOP 10 * FROM @cdm_database_schema.vocabulary;"
data <- renderTranslateQueryApplyBatched(connection,
Expand All @@ -73,7 +73,7 @@ test_that("renderTranslateQueryApplyBatched works", {
password = URLdecode(Sys.getenv("CDM5_REDSHIFT_PASSWORD")),
server = Sys.getenv("CDM5_REDSHIFT_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA")

sql <- "SELECT TOP 10 * FROM @cdm_database_schema.vocabulary;"
data <- renderTranslateQueryApplyBatched(connection,
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-dataHash.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("Compute data hash", {
server = Sys.getenv("CDM5_SQL_SERVER_SERVER")
)
connection <- connect(details)
hash <- computeDataHash(connection, Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA"))
hash <- computeDataHash(connection, Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA"))
expect_true(is.character(hash))

disconnect(connection)
Expand All @@ -35,7 +35,7 @@ test_that("Compute data hash", {
server = Sys.getenv("CDM5_ORACLE_SERVER")
)
connection <- connect(details)
hash <- computeDataHash(connection, Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"))
hash <- computeDataHash(connection, Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA"))
expect_true(is.character(hash))

disconnect(connection)
Expand All @@ -48,7 +48,7 @@ test_that("Compute data hash", {
server = Sys.getenv("CDM5_REDSHIFT_SERVER")
)
connection <- connect(details)
hash <- computeDataHash(connection, Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"))
hash <- computeDataHash(connection, Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA"))
expect_true(is.character(hash))

disconnect(connection)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-dbplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("Test dbplyr on SQL Server", {
password = URLdecode(Sys.getenv("CDM5_SQL_SERVER_PASSWORD")),
server = Sys.getenv("CDM5_SQL_SERVER_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA")
testDbplyrFunctions(connectionDetails, cdmDatabaseSchema)
})

Expand All @@ -34,7 +34,7 @@ test_that("Test dbplyr on Oracle", {
password = URLdecode(Sys.getenv("CDM5_ORACLE_PASSWORD")),
server = Sys.getenv("CDM5_ORACLE_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA")
options(sqlRenderTempEmulationSchema = Sys.getenv("CDM5_ORACLE_OHDSI_SCHEMA"))
testDbplyrFunctions(connectionDetails, cdmDatabaseSchema)
})
Expand All @@ -47,7 +47,7 @@ test_that("Test dbplyr on RedShift", {
password = URLdecode(Sys.getenv("CDM5_REDSHIFT_PASSWORD")),
server = Sys.getenv("CDM5_REDSHIFT_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA")
testDbplyrFunctions(connectionDetails, cdmDatabaseSchema)
})

Expand Down
36 changes: 18 additions & 18 deletions tests/testthat/test-fetchResults.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@ test_that("Fetch results", {
password = URLdecode(Sys.getenv("CDM5_SQL_SERVER_PASSWORD")),
server = Sys.getenv("CDM5_SQL_SERVER_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA")
sql <- "SELECT COUNT(*) AS row_count FROM @cdm_database_schema.vocabulary"
renderedSql <- SqlRender::render(sql, cdm_database_schema = cdmDatabaseSchema)

# Fetch data.frame:
count <- querySql(connection, renderedSql)
expect_equal(count[1, 1], 71)
expect_equal(count[1, 1], 58)
count <- renderTranslateQuerySql(connection, sql, cdm_database_schema = cdmDatabaseSchema)
expect_equal(count[1, 1], 71)
expect_equal(count[1, 1], 58)

# Fetch Andromeda:
andromeda <- Andromeda::andromeda()
querySqlToAndromeda(connection, renderedSql, andromeda = andromeda, andromedaTableName = "test", snakeCaseToCamelCase = TRUE)
expect_equivalent(dplyr::collect(andromeda$test)$rowCount[1], 71)
expect_equivalent(dplyr::collect(andromeda$test)$rowCount[1], 58)
renderTranslateQuerySqlToAndromeda(connection,
sql,
cdm_database_schema = cdmDatabaseSchema,
andromeda = andromeda,
andromedaTableName = "test2",
snakeCaseToCamelCase = TRUE
)
expect_equivalent(dplyr::collect(andromeda$test2)$rowCount[1], 71)
expect_equivalent(dplyr::collect(andromeda$test2)$rowCount[1], 58)
Andromeda::close(andromeda)

disconnect(connection)
Expand All @@ -80,7 +80,7 @@ test_that("Fetch results", {
password = URLdecode(Sys.getenv("CDM5_ORACLE_PASSWORD")),
server = Sys.getenv("CDM5_ORACLE_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA")
sql <- "SELECT COUNT(*) AS row_count FROM @cdm_database_schema.vocabulary"
renderedSql <- SqlRender::render(sql, cdm_database_schema = cdmDatabaseSchema)

Expand Down Expand Up @@ -119,22 +119,22 @@ test_that("Fetch results", {

# Fetch data.frame:
count <- querySql(connection, renderedSql)
expect_equal(count[1, 1], 71)
expect_equal(count[1, 1], 58)
count <- renderTranslateQuerySql(connection, sql, cdm_database_schema = cdmDatabaseSchema)
expect_equal(count[1, 1], 71)
expect_equal(count[1, 1], 58)

# Fetch Andromeda:
andromeda <- Andromeda::andromeda()
querySqlToAndromeda(connection, renderedSql, andromeda = andromeda, andromedaTableName = "test", snakeCaseToCamelCase = TRUE)
expect_equivalent(dplyr::collect(andromeda$test)$rowCount[1], 71)
expect_equivalent(dplyr::collect(andromeda$test)$rowCount[1], 58)
renderTranslateQuerySqlToAndromeda(connection,
sql,
cdm_database_schema = cdmDatabaseSchema,
andromeda = andromeda,
andromedaTableName = "test2",
snakeCaseToCamelCase = TRUE
)
expect_equivalent(dplyr::collect(andromeda$test2)$rowCount[1], 71)
expect_equivalent(dplyr::collect(andromeda$test2)$rowCount[1], 58)
Andromeda::close(andromeda)

disconnect(connection)
Expand All @@ -146,28 +146,28 @@ test_that("Fetch results", {
password = URLdecode(Sys.getenv("CDM5_REDSHIFT_PASSWORD")),
server = Sys.getenv("CDM5_REDSHIFT_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA")
sql <- "SELECT COUNT(*) AS row_count FROM @cdm_database_schema.vocabulary"
renderedSql <- SqlRender::render(sql, cdm_database_schema = cdmDatabaseSchema)

# Fetch data.frame:
count <- querySql(connection, renderedSql)
expect_equal(count[1, 1], 91)
expect_equal(count[1, 1], 58)
count <- renderTranslateQuerySql(connection, sql, cdm_database_schema = cdmDatabaseSchema)
expect_equal(count[1, 1], 91)
expect_equal(count[1, 1], 58)

# Fetch Andromeda:
andromeda <- Andromeda::andromeda()
querySqlToAndromeda(connection, renderedSql, andromeda = andromeda, andromedaTableName = "test", snakeCaseToCamelCase = TRUE)
expect_equivalent(dplyr::collect(andromeda$test)$rowCount[1], 91)
expect_equivalent(dplyr::collect(andromeda$test)$rowCount[1], 58)
renderTranslateQuerySqlToAndromeda(connection,
sql,
cdm_database_schema = cdmDatabaseSchema,
andromeda = andromeda,
andromedaTableName = "test2",
snakeCaseToCamelCase = TRUE
)
expect_equivalent(dplyr::collect(andromeda$test2)$rowCount[1], 91)
expect_equivalent(dplyr::collect(andromeda$test2)$rowCount[1], 58)
Andromeda::close(andromeda)

disconnect(connection)
Expand Down Expand Up @@ -233,7 +233,7 @@ test_that("dbFetch works", {
password = URLdecode(Sys.getenv("CDM5_ORACLE_PASSWORD")),
server = Sys.getenv("CDM5_ORACLE_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA")

sql <- "SELECT * FROM @cdm_database_schema.vocabulary FETCH FIRST 10 ROWS ONLY"
renderedSql <- SqlRender::render(sql, cdm_database_schema = cdmDatabaseSchema)
Expand All @@ -251,7 +251,7 @@ test_that("dbFetch works", {
password = URLdecode(Sys.getenv("CDM5_SQL_SERVER_PASSWORD")),
server = Sys.getenv("CDM5_SQL_SERVER_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA")

sql <- "SELECT TOP 10 * FROM @cdm_database_schema.vocabulary"
renderedSql <- SqlRender::render(sql, cdm_database_schema = cdmDatabaseSchema)
Expand All @@ -269,7 +269,7 @@ test_that("dbFetch works", {
password = URLdecode(Sys.getenv("CDM5_REDSHIFT_PASSWORD")),
server = Sys.getenv("CDM5_REDSHIFT_SERVER")
)
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA")
cdmDatabaseSchema <- Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA")

sql <- "SELECT TOP 10 * FROM @cdm_database_schema.vocabulary"
renderedSql <- SqlRender::render(sql, cdm_database_schema = cdmDatabaseSchema)
Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/test-getTableNames.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ test_that("Get table names", {
server = Sys.getenv("CDM5_SQL_SERVER_SERVER")
)
connection <- connect(details)
tables <- getTableNames(connection, Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA"))
tables <- getTableNames(connection, Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA"))
expect_true("person" %in% tables)
expect_true(existsTable(connection, Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA"), "person"))
expect_true(existsTable(connection, Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA"), "person"))
# This does not work on SQL Server:
# expect_true(DBI::dbExistsTable(connection, "person"))
disconnect(connection)
Expand All @@ -38,9 +38,9 @@ test_that("Get table names", {
server = Sys.getenv("CDM5_ORACLE_SERVER")
)
connection <- connect(details)
tables <- getTableNames(connection, Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"))
expect_true("person" %in% tables)
expect_true(existsTable(connection, Sys.getenv("CDM5_ORACLE_CDM_SCHEMA"), "person"))
tables <- getTableNames(connection, Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA"))
expect_true("person" %in% tables)
expect_true(existsTable(connection, Sys.getenv("CDM5_ORACLE_CDM54_SCHEMA"), "person"))
expect_true(DBI::dbExistsTable(connection, "person"))
disconnect(connection)

Expand All @@ -67,9 +67,9 @@ test_that("Get table names", {
server = Sys.getenv("CDM5_REDSHIFT_SERVER")
)
connection <- connect(details)
tables <- getTableNames(connection, Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"))
tables <- getTableNames(connection, Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA"))
expect_true("person" %in% tables)
expect_true(existsTable(connection, Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"), "person"))
expect_true(existsTable(connection, Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA"), "person"))
expect_true(DBI::dbExistsTable(connection, "person"))
disconnect(connection)

Expand Down Expand Up @@ -118,9 +118,9 @@ test_that("Get table names using DBI drivers", {
PWD = Sys.getenv("CDM5_SQL_SERVER_PASSWORD"),
TrustServerCertificate = "yes",
Port = 1433)
tables <- getTableNames(connection, Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA"))
tables <- getTableNames(connection, Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA"))
expect_true("person" %in% tables)
expect_true(existsTable(connection, Sys.getenv("CDM5_SQL_SERVER_CDM_SCHEMA"), "person"))
expect_true(existsTable(connection, Sys.getenv("CDM5_SQL_SERVER_CDM54_SCHEMA"), "person"))
DBI::dbDisconnect(connection)

# Sqlite --------------------------------------------------
Expand Down Expand Up @@ -152,8 +152,8 @@ test_that("Get table names using DBI drivers", {
user = Sys.getenv("CDM5_REDSHIFT_USER"),
password = Sys.getenv("CDM5_REDSHIFT_PASSWORD"))

tables <- getTableNames(connection, Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"))
tables <- getTableNames(connection, Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA"))
expect_true("person" %in% tables)
expect_true(existsTable(connection, Sys.getenv("CDM5_REDSHIFT_CDM_SCHEMA"), "person"))
expect_true(existsTable(connection, Sys.getenv("CDM5_REDSHIFT_CDM54_SCHEMA"), "person"))
DBI::dbDisconnect(connection)
})

0 comments on commit abf23de

Please sign in to comment.