-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-16351: Added tests to send bad commands, good command/bad argument…
… and check to make sure cluster is up.
- Loading branch information
wendycwong
committed
Aug 8, 2024
1 parent
ff8c280
commit b9e00a6
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
h2o-r/tests/testdir_munging/runit_GH_16351_AstRunTool_bad_commands.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f"))) | ||
source("../../scripts/h2o-r-test-setup.R") | ||
|
||
# Test to make sure that when we pass an illegal command to | ||
# AstRunTool will not crash H2O. | ||
|
||
test.astRunTimeBadCommands <- function() { | ||
iris_path_gz <- locate("smalldata/junit/iris.csv.gz") | ||
iris_path_gz_aes <- file.path(sandbox(), "iris.csv.gz.aes") | ||
|
||
keystore_path <- locate("smalldata/extdata/keystore.jks") | ||
keystore <- h2o.importFile(keystore_path, parse = FALSE) | ||
decrypt_tool <- h2o.decryptionSetup(keystore, key_alias = "secretKeyAlias", | ||
password = "Password123", cipher = "AES/ECB/PKCS5Padding") | ||
|
||
args <- c(keystore_path, "JCEKS", "secretKeyAlias", "Password123", "AES/ECB/PKCS5Padding", | ||
iris_path_gz, iris_path_gz_aes) | ||
# command is wrong | ||
tryCatch({ | ||
tool_result <- h2o.rapids(sprintf('(run_tool "EncryptionTools" ["%s"])', paste(args, collapse = '", "')))}, | ||
error = function(e) {print(e)}) | ||
iris_file <- h2o.importFile(locate("smalldata/junit/iris.csv.gz")) | ||
expect_true(h2o.clusterIsUp()) | ||
# passcode is wrong | ||
args[4] <- "password" | ||
tryCatch({ | ||
tool_result <- h2o.rapids(sprintf('(run_tool "EncryptionTool" ["%s"])', paste(args, collapse = '", "')))}, | ||
error = function(e) {print(e)}) | ||
iris_file <- h2o.importFile(locate("smalldata/junit/iris.csv.gz")) | ||
expect_true(h2o.clusterIsUp()) | ||
# keystore_path is bad | ||
args[4] = "Password123" | ||
args[1] = "/bad/Directory" | ||
tryCatch({ | ||
tool_result <- h2o.rapids(sprintf('(run_tool "EncryptionTool" ["%s"])', paste(args, collapse = '", "')))}, | ||
error = function(e) {print(e)}) | ||
expect_true(h2o.clusterIsUp()) | ||
} | ||
|
||
doTest("Test AstRunTool.java when passed with illegal commands will not crash.", test.astRunTimeBadCommands) |