Skip to content

Commit

Permalink
Skipping downloading of JDBC drivers on local system
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Jul 27, 2021
1 parent 9680663 commit 49a55c1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Download the JDBC drivers used in the tests

oldJarFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = tempfile("jdbcDrivers"))
downloadJdbcDrivers("postgresql")
downloadJdbcDrivers("sql server")
downloadJdbcDrivers("oracle")
downloadJdbcDrivers("redshift")
downloadJdbcDrivers("spark")

withr::defer({
unlink(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"), recursive = TRUE, force = TRUE)
Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = oldJarFolder)
}, 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"))
downloadJdbcDrivers("postgresql")
downloadJdbcDrivers("sql server")
downloadJdbcDrivers("oracle")
downloadJdbcDrivers("redshift")
downloadJdbcDrivers("spark")

withr::defer({
unlink(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"), recursive = TRUE, force = TRUE)
Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = oldJarFolder)
}, testthat::teardown_env())
}

0 comments on commit 49a55c1

Please sign in to comment.