From f6e7d46a6a37c3b73ebbcd2f736c688615ef50c6 Mon Sep 17 00:00:00 2001 From: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:11:52 +0100 Subject: [PATCH] Update nf-tests for v0.8.0 --- tests/main.nf.test | 15 ++- tests/main.nf.test.snap | 124 +++++++++++++++--- tests/main.test_bin_script.test.snap | 2 +- tests/main.test_create_file.nf.test.snap | 2 +- tests/main.test_create_folder.nf.test.snap | 2 +- tests/main.test_ignore_fail.test | 2 +- tests/main.test_ignore_fail.test.snap | 20 ++- tests/main.test_input.nf.test.snap | 2 +- tests/main.test_mv_file.nf.test.snap | 2 +- .../main.test_mv_folder_contents.nf.test.snap | 2 +- tests/main.test_pass_file.nf.test.snap | 2 +- tests/main.test_pass_folder.nf.test.snap | 2 +- tests/main.test_publish_file.nf.test.snap | 2 +- tests/main.test_publish_folder.nf.test.snap | 2 +- tests/main.test_stage_remote.test.snap | 2 +- tests/main.test_success.nf.test | 1 + tests/main.test_success.nf.test.snap | 6 +- 17 files changed, 146 insertions(+), 44 deletions(-) diff --git a/tests/main.nf.test b/tests/main.nf.test index d209cf1..958cc65 100644 --- a/tests/main.nf.test +++ b/tests/main.nf.test @@ -9,6 +9,7 @@ nextflow_pipeline { when { params { remoteFile = "${baseDir}/tests/testfile.txt" + outdir = "${baseDir}/output" } } @@ -17,7 +18,7 @@ nextflow_pipeline { assert workflow.trace.tasks().size() == 13 assert workflow.trace.succeeded().size() == 12 assert workflow.trace.failed().size() == 1 - assert snapshot(path("work/outputs").list()).match() + assert snapshot(workflow, path(params.outdir).list()).match() } } @@ -26,8 +27,9 @@ nextflow_pipeline { when { params { - skip = "test_success" + skip = "test_success" remoteFile = "${baseDir}/tests/testfile.txt" + outdir = "${baseDir}/output" } } @@ -36,7 +38,7 @@ nextflow_pipeline { assert workflow.trace.tasks().size() == 12 assert workflow.trace.succeeded().size() == 11 assert workflow.trace.failed().size() == 1 - assert snapshot(path("work/outputs").list()).match() + assert snapshot(workflow, path(params.outdir).list()).match() } } @@ -48,6 +50,7 @@ nextflow_pipeline { params { run = "test_success" remoteFile = "$baseDir/tests/testfile.txt" + outdir = "${baseDir}/output" } } @@ -56,7 +59,7 @@ nextflow_pipeline { assert workflow.trace.tasks().size() == 1 assert workflow.trace.succeeded().size() == 1 assert workflow.trace.failed().size() == 0 - assert snapshot(path("work/outputs").list()).match() + assert snapshot(workflow, path(params.outdir).list()).match() } } @@ -65,7 +68,7 @@ nextflow_pipeline { when { params { - outdir = "results" + outdir = "${baseDir}/output2" } } @@ -74,7 +77,7 @@ nextflow_pipeline { assert workflow.trace.tasks().size() == 12 assert workflow.trace.succeeded().size() == 11 assert workflow.trace.failed().size() == 1 - assert snapshot(path(params.outdir).list()).match() + assert snapshot(workflow, path("${baseDir}/output2").list()).match() } } diff --git a/tests/main.nf.test.snap b/tests/main.nf.test.snap index 3dea895..5b83b40 100644 --- a/tests/main.nf.test.snap +++ b/tests/main.nf.test.snap @@ -1,42 +1,126 @@ { "Should skip a process": { "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 1, + "tasksCount": 12, + "tasksSucceeded": 11 + }, + "name": "workflow", + "success": true + }, [ - "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", - "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" - ], - "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], - "timestamp": "2023-10-04T11:44:43.844549" + "timestamp": "2023-10-04T12:09:12.963778" }, "Should publish to alternative directory": { "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 1, + "tasksCount": 12, + "tasksSucceeded": 11 + }, + "name": "workflow", + "success": true + }, [ - "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", - "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" - ], - "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], - "timestamp": "2023-10-04T11:44:48.06743" + "timestamp": "2023-10-04T12:09:17.25461" }, "Should only run one process": { "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 0, + "tasksCount": 1, + "tasksSucceeded": 1 + }, + "name": "workflow", + "success": true + }, [ - "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", - "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" - ], - "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], - "timestamp": "2023-10-04T11:44:45.712702" + "timestamp": "2023-10-04T12:09:14.732431" }, "Should run without failures": { "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 1, + "tasksCount": 13, + "tasksSucceeded": 12 + }, + "name": "workflow", + "success": true + }, [ - "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", - "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" - ], - "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], - "timestamp": "2023-10-04T11:44:41.565486" + "timestamp": "2023-10-04T12:07:58.679961" } } \ No newline at end of file diff --git a/tests/main.test_bin_script.test.snap b/tests/main.test_bin_script.test.snap index 42daa0d..6978294 100644 --- a/tests/main.test_bin_script.test.snap +++ b/tests/main.test_bin_script.test.snap @@ -7,6 +7,6 @@ ] } ], - "timestamp": "2023-08-04T14:56:30+0000" + "timestamp": "2023-10-04T12:00:35.045745" } } \ No newline at end of file diff --git a/tests/main.test_create_file.nf.test.snap b/tests/main.test_create_file.nf.test.snap index 23f3458..a9e0079 100644 --- a/tests/main.test_create_file.nf.test.snap +++ b/tests/main.test_create_file.nf.test.snap @@ -10,6 +10,6 @@ ] } ], - "timestamp": "2023-07-20T10:50:02+0000" + "timestamp": "2023-10-04T11:56:41.550158" } } \ No newline at end of file diff --git a/tests/main.test_create_folder.nf.test.snap b/tests/main.test_create_folder.nf.test.snap index 6ee733a..9342c07 100644 --- a/tests/main.test_create_folder.nf.test.snap +++ b/tests/main.test_create_folder.nf.test.snap @@ -16,6 +16,6 @@ ] } ], - "timestamp": "2023-08-04T15:17:57+0000" + "timestamp": "2023-10-04T11:56:39.696681" } } \ No newline at end of file diff --git a/tests/main.test_ignore_fail.test b/tests/main.test_ignore_fail.test index d366ac2..0927524 100644 --- a/tests/main.test_ignore_fail.test +++ b/tests/main.test_ignore_fail.test @@ -8,7 +8,7 @@ nextflow_process { then { assert process.success - assert snapshot(process.out).match() + assert snapshot(process).match() assert process.trace.failed().size() == 1 assert process.trace.succeeded().size() == 0 } diff --git a/tests/main.test_ignore_fail.test.snap b/tests/main.test_ignore_fail.test.snap index e54bdbf..dd94a7c 100644 --- a/tests/main.test_ignore_fail.test.snap +++ b/tests/main.test_ignore_fail.test.snap @@ -2,9 +2,25 @@ "Should run without failures": { "content": [ { - + "stderr": [ + + ], + "errorReport": null, + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": null, + "trace": { + "tasksFailed": 1, + "tasksCount": 1, + "tasksSucceeded": 0 + }, + "name": "TEST_IGNORED_FAIL", + "success": true } ], - "timestamp": "2023-08-04T15:05:45+0000" + "timestamp": "2023-10-04T12:11:38.820379" } } \ No newline at end of file diff --git a/tests/main.test_input.nf.test.snap b/tests/main.test_input.nf.test.snap index c40c740..a191682 100644 --- a/tests/main.test_input.nf.test.snap +++ b/tests/main.test_input.nf.test.snap @@ -7,6 +7,6 @@ ] } ], - "timestamp": "2023-07-20T10:49:51+0000" + "timestamp": "2023-10-04T11:56:21.166077" } } \ No newline at end of file diff --git a/tests/main.test_mv_file.nf.test.snap b/tests/main.test_mv_file.nf.test.snap index 7d4a101..9229b6a 100644 --- a/tests/main.test_mv_file.nf.test.snap +++ b/tests/main.test_mv_file.nf.test.snap @@ -7,6 +7,6 @@ ] } ], - "timestamp": "2023-08-18T10:33:06+0000" + "timestamp": "2023-10-04T11:56:19.102784" } } \ No newline at end of file diff --git a/tests/main.test_mv_folder_contents.nf.test.snap b/tests/main.test_mv_folder_contents.nf.test.snap index 97a8779..45bc8a1 100644 --- a/tests/main.test_mv_folder_contents.nf.test.snap +++ b/tests/main.test_mv_folder_contents.nf.test.snap @@ -20,6 +20,6 @@ ] } ], - "timestamp": "2023-08-18T10:33:34+0000" + "timestamp": "2023-10-04T11:56:17.157386" } } \ No newline at end of file diff --git a/tests/main.test_pass_file.nf.test.snap b/tests/main.test_pass_file.nf.test.snap index f7f951e..27eba1e 100644 --- a/tests/main.test_pass_file.nf.test.snap +++ b/tests/main.test_pass_file.nf.test.snap @@ -10,6 +10,6 @@ ] } ], - "timestamp": "2023-07-20T10:49:46+0000" + "timestamp": "2023-10-04T11:56:24.966198" } } \ No newline at end of file diff --git a/tests/main.test_pass_folder.nf.test.snap b/tests/main.test_pass_folder.nf.test.snap index b414c99..d68fa19 100644 --- a/tests/main.test_pass_folder.nf.test.snap +++ b/tests/main.test_pass_folder.nf.test.snap @@ -20,6 +20,6 @@ ] } ], - "timestamp": "2023-08-04T15:47:13+0000" + "timestamp": "2023-10-04T11:56:15.249734" } } \ No newline at end of file diff --git a/tests/main.test_publish_file.nf.test.snap b/tests/main.test_publish_file.nf.test.snap index 1d9b1ea..91bd257 100644 --- a/tests/main.test_publish_file.nf.test.snap +++ b/tests/main.test_publish_file.nf.test.snap @@ -7,6 +7,6 @@ ] } ], - "timestamp": "2023-07-20T10:49:56+0000" + "timestamp": "2023-10-04T11:56:23.047403" } } \ No newline at end of file diff --git a/tests/main.test_publish_folder.nf.test.snap b/tests/main.test_publish_folder.nf.test.snap index ca3ef88..ff99057 100644 --- a/tests/main.test_publish_folder.nf.test.snap +++ b/tests/main.test_publish_folder.nf.test.snap @@ -10,6 +10,6 @@ ] } ], - "timestamp": "2023-08-04T17:04:25+0000" + "timestamp": "2023-10-04T11:56:26.981311" } } \ No newline at end of file diff --git a/tests/main.test_stage_remote.test.snap b/tests/main.test_stage_remote.test.snap index 8ff76e3..55707cf 100644 --- a/tests/main.test_stage_remote.test.snap +++ b/tests/main.test_stage_remote.test.snap @@ -7,6 +7,6 @@ ] } ], - "timestamp": "2023-07-20T15:50:59+0000" + "timestamp": "2023-10-04T12:00:49.001095" } } \ No newline at end of file diff --git a/tests/main.test_success.nf.test b/tests/main.test_success.nf.test index f46c66c..c35362a 100644 --- a/tests/main.test_success.nf.test +++ b/tests/main.test_success.nf.test @@ -10,6 +10,7 @@ nextflow_process { assert process.success assert process.exitStatus == 0 assert process.trace.tasks().size() == 1 + assert snapshot(process).match() } } diff --git a/tests/main.test_success.nf.test.snap b/tests/main.test_success.nf.test.snap index c3f405e..69ac91d 100644 --- a/tests/main.test_success.nf.test.snap +++ b/tests/main.test_success.nf.test.snap @@ -1,10 +1,8 @@ { "Should run without failures": { "content": [ - { - - } + ], - "timestamp": "2023-07-20T10:50:08+0000" + "timestamp": "2023-10-04T12:01:15.677026" } } \ No newline at end of file