Skip to content

Commit

Permalink
preserve randomness in table generation
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Apr 26, 2024
1 parent ca8b000 commit 00dba6a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/testthat/test-UploadToDatabase.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ connectionRedshift <- DatabaseConnector::createConnectionDetails(
conn <- DatabaseConnector::connect(connectionRedshift)
targetDialect <- 'postgresql'

randVar <- rawToChar(as.raw(sample(c(65:90,97:122), 5, replace=T)))
withr::with_seed(NULL, {
randVar <- rawToChar(as.raw(sample(c(65:90,97:122), 5, replace=T)))
}
)

appendRandom <- function(x, rand = randVar){
return(paste("plp_", rand, x, sep=''))
return(paste("plp", rand, x, sep=''))
}

}
Expand Down Expand Up @@ -119,7 +123,7 @@ test_that("database creation", {

test_that("results uploaded to database", {
skip_if(Sys.getenv('CI') != 'true', 'not run locally')
resultsLoc <- file.path(saveLoc,'dbUp')
resultsLoc <- file.path(saveLoc,'dbUp')

plpResult$model$trainDetails$developmentDatabase <- 'test'
savePlpResult(plpResult, file.path(resultsLoc, 'Analysis_1','plpResult'))
Expand Down

0 comments on commit 00dba6a

Please sign in to comment.