Skip to content

Commit

Permalink
Add in content need for tests to pass on Azure (#27)
Browse files Browse the repository at this point in the history
Closes #24

---------

Co-authored-by: Venkat Malladi <vmalladi@microsoft.com>
  • Loading branch information
adamrtalbot and vsmalladi committed Apr 19, 2024
1 parent 3d0d980 commit 52e562c
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 25 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
23 changes: 19 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -278,4 +293,4 @@ workflow NF_CANARY {

workflow {
NF_CANARY()
}
}
12 changes: 6 additions & 6 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
)
Expand All @@ -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() }
)
Expand Down Expand Up @@ -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() }
)
Expand Down
18 changes: 9 additions & 9 deletions tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"errorMessage": "",
"trace": {
"tasksFailed": 1,
"tasksCount": 13,
"tasksSucceeded": 12
"tasksCount": 14,
"tasksSucceeded": 13
},
"name": "workflow",
"success": true
Expand All @@ -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": [
Expand All @@ -49,8 +49,8 @@
"errorMessage": "",
"trace": {
"tasksFailed": 1,
"tasksCount": 14,
"tasksSucceeded": 13
"tasksCount": 15,
"tasksSucceeded": 14
},
"name": "workflow",
"success": true
Expand All @@ -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": [
Expand Down Expand Up @@ -115,8 +115,8 @@
"errorMessage": "",
"trace": {
"tasksFailed": 1,
"tasksCount": 14,
"tasksSucceeded": 13
"tasksCount": 15,
"tasksSucceeded": 14
},
"name": "workflow",
"success": true
Expand All @@ -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"
}
}
18 changes: 18 additions & 0 deletions tests/main.test_create_empty_file.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}

}

}
19 changes: 19 additions & 0 deletions tests/main.test_create_empty_file.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}
4 changes: 2 additions & 2 deletions tests/main.test_create_file.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"content": [
{
"0": [
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
"test.txt:md5,d8e8fca2dc0f896fd7cb4cb0031ba249"
],
"outfile": [
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
"test.txt:md5,d8e8fca2dc0f896fd7cb4cb0031ba249"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions tests/main.test_create_folder.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
]
}
Expand Down

0 comments on commit 52e562c

Please sign in to comment.