Skip to content

Commit

Permalink
Update nf-tests for v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrtalbot committed Oct 4, 2023
1 parent b42744d commit f6e7d46
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 44 deletions.
15 changes: 9 additions & 6 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ nextflow_pipeline {
when {
params {
remoteFile = "${baseDir}/tests/testfile.txt"
outdir = "${baseDir}/output"
}
}

Expand All @@ -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()
}

}
Expand All @@ -26,8 +27,9 @@ nextflow_pipeline {

when {
params {
skip = "test_success"
skip = "test_success"
remoteFile = "${baseDir}/tests/testfile.txt"
outdir = "${baseDir}/output"
}
}

Expand All @@ -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()
}

}
Expand All @@ -48,6 +50,7 @@ nextflow_pipeline {
params {
run = "test_success"
remoteFile = "$baseDir/tests/testfile.txt"
outdir = "${baseDir}/output"
}
}

Expand All @@ -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()
}

}
Expand All @@ -65,7 +68,7 @@ nextflow_pipeline {

when {
params {
outdir = "results"
outdir = "${baseDir}/output2"
}
}

Expand All @@ -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()
}

}
Expand Down
124 changes: 104 additions & 20 deletions tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_bin_script.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
]
}
],
"timestamp": "2023-08-04T14:56:30+0000"
"timestamp": "2023-10-04T12:00:35.045745"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_create_file.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
]
}
],
"timestamp": "2023-07-20T10:50:02+0000"
"timestamp": "2023-10-04T11:56:41.550158"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_create_folder.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
]
}
],
"timestamp": "2023-08-04T15:17:57+0000"
"timestamp": "2023-10-04T11:56:39.696681"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_ignore_fail.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
20 changes: 18 additions & 2 deletions tests/main.test_ignore_fail.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_input.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
]
}
],
"timestamp": "2023-07-20T10:49:51+0000"
"timestamp": "2023-10-04T11:56:21.166077"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_mv_file.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
]
}
],
"timestamp": "2023-08-18T10:33:06+0000"
"timestamp": "2023-10-04T11:56:19.102784"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_mv_folder_contents.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
]
}
],
"timestamp": "2023-08-18T10:33:34+0000"
"timestamp": "2023-10-04T11:56:17.157386"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_pass_file.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
]
}
],
"timestamp": "2023-07-20T10:49:46+0000"
"timestamp": "2023-10-04T11:56:24.966198"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_pass_folder.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
]
}
],
"timestamp": "2023-08-04T15:47:13+0000"
"timestamp": "2023-10-04T11:56:15.249734"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_publish_file.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
]
}
],
"timestamp": "2023-07-20T10:49:56+0000"
"timestamp": "2023-10-04T11:56:23.047403"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_publish_folder.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
]
}
],
"timestamp": "2023-08-04T17:04:25+0000"
"timestamp": "2023-10-04T11:56:26.981311"
}
}
2 changes: 1 addition & 1 deletion tests/main.test_stage_remote.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
]
}
],
"timestamp": "2023-07-20T15:50:59+0000"
"timestamp": "2023-10-04T12:00:49.001095"
}
}
1 change: 1 addition & 0 deletions tests/main.test_success.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nextflow_process {
assert process.success
assert process.exitStatus == 0
assert process.trace.tasks().size() == 1
assert snapshot(process).match()
}

}
Expand Down
6 changes: 2 additions & 4 deletions tests/main.test_success.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"Should run without failures": {
"content": [
{

}

],
"timestamp": "2023-07-20T10:50:08+0000"
"timestamp": "2023-10-04T12:01:15.677026"
}
}

0 comments on commit f6e7d46

Please sign in to comment.