Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stubs and test for rnaseq modules - part IV #5939

Merged
merged 24 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion modules/nf-core/untar/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,19 @@ process UNTAR {
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.toString().replaceFirst(/\.[^\.]+(.gz)?$/, ""))
"""
mkdir $prefix
touch ${prefix}/file.txt
## Ensures --strip-components only applied when top level of tar contents is a directory
## If just files or multiple directories, place all in prefix
if [[ \$(tar -taf ${archive} | grep -o -P "^.*?\\/" | uniq | wc -l) -eq 1 ]]; then
for i in `tar -tf ${archive}`;
do
touch \${i}
done
else
for i in `tar -tf ${archive}`;
do
touch ${prefix}/\${i}
done
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
47 changes: 41 additions & 6 deletions modules/nf-core/untar/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ nextflow_process {
name "Test Process UNTAR"
script "../main.nf"
process "UNTAR"
tag "modules"
tag "modules_nfcore"
tag "untar"

test("test_untar") {

when {
Expand All @@ -19,10 +17,9 @@ nextflow_process {
then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out.untar).match("test_untar") },
{ assert snapshot(process.out).match() },
)
}

}

test("test_untar_onlyfiles") {
Expand All @@ -38,10 +35,48 @@ nextflow_process {
then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out.untar).match("test_untar_onlyfiles") },
{ assert snapshot(process.out).match() },
)
}
}

test("test_untar - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kraken2.tar.gz', checkIfExists: true) ]
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() },
)
}
}

test("test_untar_onlyfiles - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true) ]
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() },
)
}
}
}
152 changes: 134 additions & 18 deletions modules/nf-core/untar/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,42 +1,158 @@
{
"test_untar_onlyfiles": {
"content": [
[
[
{
"0": [
[

],
[

],
[
"hello.txt:md5,e59ff97941044f85df5297e1c302d260"
]
]
],
"1": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
],
"untar": [
[
[

],
[
"hello.txt:md5,e59ff97941044f85df5297e1c302d260"
]
]
],
"versions": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-09T10:04:43.984731"
},
"test_untar_onlyfiles - stub": {
"content": [
{
"0": [
[
[

],
[
"hello.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
],
"untar": [
[
"hello.txt:md5,e59ff97941044f85df5297e1c302d260"
[

],
[
"hello.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
]
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-02-28T11:49:41.320643"
"timestamp": "2024-07-09T10:05:00.262496"
},
"test_untar - stub": {
"content": [
{
"0": [
[
[

],
[
"hash.k2d:md5,d41d8cd98f00b204e9800998ecf8427e",
"opts.k2d:md5,d41d8cd98f00b204e9800998ecf8427e",
"taxo.k2d:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
],
"untar": [
[
[

],
[
"hash.k2d:md5,d41d8cd98f00b204e9800998ecf8427e",
"opts.k2d:md5,d41d8cd98f00b204e9800998ecf8427e",
"taxo.k2d:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-09T10:04:52.000213"
},
"test_untar": {
"content": [
[
[
{
"0": [
[

],
[

],
[
"hash.k2d:md5,8b8598468f54a7087c203ad0190555d9",
"opts.k2d:md5,a033d00cf6759407010b21700938f543",
"taxo.k2d:md5,094d5891cdccf2f1468088855c214b2c"
]
]
],
"1": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
],
"untar": [
[
"hash.k2d:md5,8b8598468f54a7087c203ad0190555d9",
"opts.k2d:md5,a033d00cf6759407010b21700938f543",
"taxo.k2d:md5,094d5891cdccf2f1468088855c214b2c"
[

],
[
"hash.k2d:md5,8b8598468f54a7087c203ad0190555d9",
"opts.k2d:md5,a033d00cf6759407010b21700938f543",
"taxo.k2d:md5,094d5891cdccf2f1468088855c214b2c"
]
]
],
"versions": [
"versions.yml:md5,19efec1f58773173ead5b1253b1ecfa9"
]
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-02-28T11:49:33.795172"
"timestamp": "2024-07-09T10:04:35.16268"
}
}
Loading