-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tested start_qsub, start_rabbitmq, start_serial
- Loading branch information
1 parent
27e9122
commit 99771a9
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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,11 @@ | ||
test_that("`start_qsub()` able to correctly make the command to be executed remotely to start qsub runs", { | ||
mocked_res <- mockery::mock(0) | ||
mockery::stub(start_qsub, 'remote.execute.cmd', mocked_res) | ||
res <- start_qsub(1, "qsub -N @NAME@ -o @STDOUT@ -e @STDERR@", "test_rundir", "pecan", "test_host_rundir", "test_host_outdir", "test_stdout_log", "test_stderr_log", "test_job_script") | ||
args <- mockery::mock_args(mocked_res) | ||
expect_equal(args[[1]][[1]], 'pecan') | ||
expect_equal(args[[1]][[2]], c('qsub', '-N', 'PEcAn-1', '-o', 'test_host_outdir/1/test_stdout_log', '-e', 'test_host_outdir/1/test_stderr_log')) | ||
expect_equal(args[[1]][[3]][[1]], 'test_host_rundir/1/test_job_script') | ||
expect_equal(args[[1]]$stderr, TRUE) | ||
expect_equal(res, 0) | ||
}) |
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,13 @@ | ||
test_that("`start_rabbitmq()` able to correctly read the environment varibles and send desired values to rabbitmq_post_message", { | ||
withr::with_envvar(c("RABBITMQ_PREFIX" = "prefix", "RABBITMQ_PORT" = "3000"),{ | ||
mocked_res <- mockery::mock(TRUE) | ||
mockery::stub(start_rabbitmq, 'rabbitmq_post_message', mocked_res) | ||
res <- start_rabbitmq('test_folder', 'test_uri', 'test_queue') | ||
args <- mockery::mock_args(mocked_res) | ||
expect_equal(args[[1]][[1]], 'test_uri') | ||
expect_equal(args[[1]][[2]], 'test_queue') | ||
expect_equal(args[[1]][[3]], list(folder = 'test_folder')) | ||
expect_equal(args[[1]][[4]], 'prefix') | ||
expect_equal(args[[1]][[5]], '3000') | ||
}) | ||
}) |
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,9 @@ | ||
test_that("`start_serial()` able to pass desired parameters to execute command remotely to start model execution in serial mode",{ | ||
mocked_res <- mockery::mock(TRUE) | ||
mockery::stub(start_serial, 'remote.execute.cmd', mocked_res) | ||
res <- start_serial('test_run', 'pecan', 'test_rundir', 'test_host_rundir', 'test_job_script') | ||
args <- mockery::mock_args(mocked_res) | ||
expect_equal(args[[1]][[1]], 'pecan') | ||
expect_equal(args[[1]][[2]], 'test_host_rundir/test_run/test_job_script') | ||
expect_equal(res, TRUE) | ||
}) |