diff --git a/README.md b/README.md index 39b9a69..0639c03 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ This process should succeed automatically with exit status 0. This process creates a file on the worker machine and then moves it to the working directory. +### `TEST_CREATE_EMPTY_FILE` + +This process creates an empty file on the worker machine and then moves it to the working directory. + ### `TEST_CREATE_FOLDER` This process creates a folder in the working directory. diff --git a/main.nf b/main.nf index 2efb21c..04effd9 100644 --- a/main.nf +++ b/main.nf @@ -17,6 +17,19 @@ process TEST_CREATE_FILE { Creates a file on the worker node which is uploaded to the working directory. */ + output: + path("*.txt"), emit: outfile + + """ + echo "test" > test.txt + """ +} + +process TEST_CREATE_EMPTY_FILE { + /* + Creates an empty file on the worker node which is uploaded to the working directory. + */ + output: path("*.txt"), emit: outfile @@ -35,8 +48,8 @@ process TEST_CREATE_FOLDER { """ mkdir -p test - touch test/test1.txt - touch test/test2.txt + echo "test1" > test/test1.txt + echo "test2" > test/test2.txt """ } @@ -240,7 +253,8 @@ workflow NF_CANARY { // Run tests TEST_SUCCESS() TEST_CREATE_FILE() - TEST_CREATE_FOLDER() + TEST_CREATE_EMPTY_FILE() + TEST_CREATE_FOLDER() TEST_INPUT(test_file) TEST_BIN_SCRIPT() TEST_STAGE_REMOTE(remote_file) @@ -258,6 +272,7 @@ workflow NF_CANARY { .mix( TEST_SUCCESS.out, TEST_CREATE_FILE.out, + TEST_CREATE_EMPTY_FILE.out, TEST_CREATE_FOLDER.out, TEST_INPUT.out, TEST_BIN_SCRIPT.out, @@ -278,4 +293,4 @@ workflow NF_CANARY { workflow { NF_CANARY() -} \ No newline at end of file +} diff --git a/tests/main.nf.test b/tests/main.nf.test index 2d6d957..137bf73 100644 --- a/tests/main.nf.test +++ b/tests/main.nf.test @@ -15,8 +15,8 @@ nextflow_pipeline{ then { assertAll( { assert workflow.success }, - { assert workflow.trace.tasks().size() == 14 }, - { assert workflow.trace.succeeded().size() == 13 }, + { assert workflow.trace.tasks().size() == 15 }, + { assert workflow.trace.succeeded().size() == 14 }, { assert workflow.trace.failed().size() == 1 }, { assert snapshot(workflow, path(params.outdir).list()).match() } ) @@ -37,8 +37,8 @@ nextflow_pipeline{ then { assertAll( { assert workflow.success }, - { assert workflow.trace.tasks().size() == 13 }, - { assert workflow.trace.succeeded().size() == 12 }, + { assert workflow.trace.tasks().size() == 14 }, + { assert workflow.trace.succeeded().size() == 13 }, { assert workflow.trace.failed().size() == 1 }, { assert snapshot(workflow, path(params.outdir).list()).match() } ) @@ -81,8 +81,8 @@ nextflow_pipeline{ then { assertAll( { assert workflow.success }, - { assert workflow.trace.tasks().size() == 14 }, - { assert workflow.trace.succeeded().size() == 13 }, + { assert workflow.trace.tasks().size() == 15 }, + { assert workflow.trace.succeeded().size() == 14 }, { assert workflow.trace.failed().size() == 1 }, { assert snapshot(workflow, path("${launchDir}/output").list()).match() } ) diff --git a/tests/main.nf.test.snap b/tests/main.nf.test.snap index 30e6786..0600c27 100644 --- a/tests/main.nf.test.snap +++ b/tests/main.nf.test.snap @@ -14,8 +14,8 @@ "errorMessage": "", "trace": { "tasksFailed": 1, - "tasksCount": 13, - "tasksSucceeded": 12 + "tasksCount": 14, + "tasksSucceeded": 13 }, "name": "workflow", "success": true @@ -32,7 +32,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-18T17:10:49.052904" + "timestamp": "2024-04-19T09:04:04.680628" }, "Should publish to alternative directory": { "content": [ @@ -49,8 +49,8 @@ "errorMessage": "", "trace": { "tasksFailed": 1, - "tasksCount": 14, - "tasksSucceeded": 13 + "tasksCount": 15, + "tasksSucceeded": 14 }, "name": "workflow", "success": true @@ -67,7 +67,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-18T17:10:53.086666" + "timestamp": "2024-04-19T09:04:08.847329" }, "Should only run one process": { "content": [ @@ -115,8 +115,8 @@ "errorMessage": "", "trace": { "tasksFailed": 1, - "tasksCount": 14, - "tasksSucceeded": 13 + "tasksCount": 15, + "tasksSucceeded": 14 }, "name": "workflow", "success": true @@ -133,6 +133,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-18T17:10:47.053474" + "timestamp": "2024-04-19T09:04:02.601858" } } \ No newline at end of file diff --git a/tests/main.test_create_empty_file.nf.test b/tests/main.test_create_empty_file.nf.test new file mode 100644 index 0000000..2d5fde8 --- /dev/null +++ b/tests/main.test_create_empty_file.nf.test @@ -0,0 +1,18 @@ +nextflow_process { + + name "Test Process TEST_CREATE_EMPTY_FILE" + script "main.nf" + process "TEST_CREATE_EMPTY_FILE" + + test("TEST_CREATE_EMPTY_FILE") { + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/tests/main.test_create_empty_file.nf.test.snap b/tests/main.test_create_empty_file.nf.test.snap new file mode 100644 index 0000000..eb89868 --- /dev/null +++ b/tests/main.test_create_empty_file.nf.test.snap @@ -0,0 +1,19 @@ +{ + "TEST_CREATE_EMPTY_FILE": { + "content": [ + { + "0": [ + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "outfile": [ + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-18T17:19:44.512229" + } +} \ 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 80e1693..03390c9 100644 --- a/tests/main.test_create_file.nf.test.snap +++ b/tests/main.test_create_file.nf.test.snap @@ -3,10 +3,10 @@ "content": [ { "0": [ - "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.txt:md5,d8e8fca2dc0f896fd7cb4cb0031ba249" ], "outfile": [ - "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.txt:md5,d8e8fca2dc0f896fd7cb4cb0031ba249" ] } ], diff --git a/tests/main.test_create_folder.nf.test.snap b/tests/main.test_create_folder.nf.test.snap index efb35c6..bc3f25e 100644 --- a/tests/main.test_create_folder.nf.test.snap +++ b/tests/main.test_create_folder.nf.test.snap @@ -4,14 +4,14 @@ { "0": [ [ - "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", - "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + "test1.txt:md5,3e7705498e8be60520841409ebc69bc1", + "test2.txt:md5,126a8a51b9d1bbd07fddc65819a542c3" ] ], "outfolder": [ [ - "test1.txt:md5,d41d8cd98f00b204e9800998ecf8427e", - "test2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + "test1.txt:md5,3e7705498e8be60520841409ebc69bc1", + "test2.txt:md5,126a8a51b9d1bbd07fddc65819a542c3" ] ] }