forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nf-test custom/sratoolsncbisettings (nf-core#3964)
* Add nf-test for custom/sratoolsncbisettings * Add custom/sratoolsncbisettings to tags * Update custom/sratoolsncbisettings nf-test * Remove pytest * Add tags * Snap update * nf-test custom/sratoolsncbisettings fix test * User configurable tmpdir via environment variable TMPDIR * add custom configuration file * Add config * Add workflow from original test * Re-add old tests back * Check stdout of process * Update tests to user iterator
- Loading branch information
1 parent
4e64083
commit c1823cf
Showing
9 changed files
with
135 additions
and
103 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
112 changes: 112 additions & 0 deletions
112
modules/nf-core/custom/sratoolsncbisettings/tests/main.nf.test
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,112 @@ | ||
nextflow_process { | ||
|
||
name "Test Process CUSTOM_SRATOOLSNCBISETTINGS" | ||
script "../main.nf" | ||
process "CUSTOM_SRATOOLSNCBISETTINGS" | ||
config "modules/nf-core/custom/sratoolsncbisettings/tests/nextflow.config" | ||
tag "custom" | ||
tag "custom/sratoolsncbisettings" | ||
|
||
test("Should run without failures") { | ||
|
||
when { | ||
params { | ||
settings_path = '/tmp/.ncbi' | ||
settings_file = "${params.settings_path}/user-settings.mkfg" | ||
} | ||
|
||
process { | ||
""" | ||
file(params.settings_path).mkdirs() | ||
def settings = file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true) | ||
settings.copyTo(params.settings_file) | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assert process.success | ||
assert snapshot( | ||
process.out.versions | ||
).match() | ||
|
||
with(process.out.ncbi_settings) { | ||
assert path(get(0)).readLines().any { it.contains('/LIBS/GUID') } | ||
assert path(get(0)).readLines().any { it.contains('/libs/cloud/report_instance_identity') } | ||
} | ||
} | ||
|
||
} | ||
|
||
test("Should fail") { | ||
|
||
when { | ||
params { | ||
settings_path = '/tmp/.ncbi' | ||
settings_file = "${params.settings_path}/user-settings.mkfg" | ||
} | ||
|
||
process { | ||
""" | ||
file(params.settings_path).mkdirs() | ||
def settings = file(params.settings_file) | ||
settings.text = ''' | ||
## auto-generated configuration file - DO NOT EDIT ## | ||
config/default = "false" | ||
/repository/remote/main/CGI/resolver-cgi = "https://trace.ncbi.nlm.nih.gov/Traces/names/names.fcgi" | ||
/repository/remote/protected/CGI/resolver-cgi = "https://trace.ncbi.nlm.nih.gov/Traces/names/names.fcgi" | ||
/repository/user/ad/public/apps/file/volumes/flatAd = "." | ||
/repository/user/ad/public/apps/refseq/volumes/refseqAd = "." | ||
/repository/user/ad/public/apps/sra/volumes/sraAd = "." | ||
/repository/user/ad/public/apps/sraPileup/volumes/ad = "." | ||
/repository/user/ad/public/apps/sraRealign/volumes/ad = "." | ||
/repository/user/ad/public/apps/wgs/volumes/wgsAd = "." | ||
/repository/user/ad/public/root = "." | ||
/repository/user/default-path = "/root/ncbi" | ||
'''.stripIndent() | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assert process.failed | ||
assert snapshot( | ||
process.out.versions | ||
).match() | ||
assert process.stdout.any { it.contains('Command error:') } | ||
assert process.stdout.any { it.contains('missing the required entries') } | ||
assert process.stdout.any { it.contains('/LIBS/GUID') } | ||
assert process.stdout.any { it.contains('/libs/cloud/report_instance_identity') } | ||
} | ||
|
||
} | ||
|
||
test("Should run with nonexisting") { | ||
|
||
when { | ||
params { | ||
settings_path = '/tmp/.ncbi' | ||
settings_file = "${params.settings_path}/user-settings.mkfg" | ||
} | ||
|
||
process { | ||
""" | ||
def settings = file(params.settings_file) | ||
settings.delete() | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assert process.success | ||
assert snapshot(process.out.versions).match() | ||
|
||
with(process.out.ncbi_settings) { | ||
{ assert path(get(0)).readLines().any { it.contains('/LIBS/GUID') } } | ||
{ assert path(get(0)).readLines().any { it.contains('/libs/cloud/report_instance_identity') } } | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
modules/nf-core/custom/sratoolsncbisettings/tests/main.nf.test.snap
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,18 @@ | ||
{ | ||
"Should run with nonexisting": { | ||
"content": [ | ||
[ | ||
"versions.yml:md5,fec13b593c3b42ddd38f2fc77df25b70" | ||
] | ||
], | ||
"timestamp": "2023-10-12T12:24:24.023849" | ||
}, | ||
"Should run without failures": { | ||
"content": [ | ||
[ | ||
"versions.yml:md5,fec13b593c3b42ddd38f2fc77df25b70" | ||
] | ||
], | ||
"timestamp": "2023-10-12T10:40:51.717351" | ||
} | ||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
tests/modules/nf-core/custom/sratoolsncbisettings/nextflow.config
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
tests/modules/nf-core/custom/sratoolsncbisettings/test.yml
This file was deleted.
Oops, something went wrong.