Skip to content

Commit 261b729

Browse files
committed
Add log checks
1 parent 5bced22 commit 261b729

2 files changed

Lines changed: 79 additions & 9 deletions

File tree

tests/test_alternatives.nf.test

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
nextflow_pipeline {
22

3-
name "Test pipeline"
3+
name "Test nf-core/mag"
44
script "../main.nf"
55
tag "pipeline"
66
tag "test_alternatives"
@@ -23,6 +23,9 @@ nextflow_pipeline {
2323
def stable_path_qc = getAllFilesFromDir(
2424
params.outdir, include: ['QC_shortreads/**'], ignoreFile: 'tests/.nftignore'
2525
)
26+
def remove_phix_logs = getAllFilesFromDir(
27+
params.outdir, include: ['QC_shortreads/remove_phix/*.log']
28+
)
2629

2730
// Output dir: Assembly
2831
def stable_name_assembly = getAllFilesFromDir(
@@ -31,6 +34,12 @@ nextflow_pipeline {
3134
def stable_path_assembly = getAllFilesFromDir(
3235
params.outdir, include: ['Assembly/**'], ignoreFile: 'tests/.nftignore'
3336
)
37+
def megahit_logs = getAllFilesFromDir(
38+
params.outdir, include: ['Assembly/MEGAHIT/*.log']
39+
)
40+
def bowtie2_logs = getAllFilesFromDir(
41+
params.outdir, include: ['Assembly/MEGAHIT/QC/*/*.bowtie2.log']
42+
)
3443

3544
// Output dir: GenomeBinning
3645
def stable_name_binning = getAllFilesFromDir(
@@ -39,6 +48,12 @@ nextflow_pipeline {
3948
def stable_path_binning = getAllFilesFromDir(
4049
params.outdir, include: ['GenomeBinning/**'], ignoreFile: 'tests/.nftignore'
4150
)
51+
def checkm2_logs = getAllFilesFromDir(
52+
params.outdir, include: ['GenomeBinning/QC/CheckM2/*/checkm2.log']
53+
)
54+
def checkm2_diamond_results = getAllFilesFromDir(
55+
params.outdir, include: ['GenomeBinning/QC/CheckM2/**/DIAMOND_RESULTS.tsv']
56+
)
4257

4358
// Output dir: multiqc
4459
def stable_name_multiqc = getAllFilesFromDir(
@@ -51,16 +66,33 @@ nextflow_pipeline {
5166
assertAll(
5267
{ assert workflow.success },
5368
{ assert snapshot(
54-
// Number of successful tasks
5569
workflow.trace.succeeded().size(),
56-
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we test pipelines on multiple Nextflow versions
5770
removeNextflowVersion("${outputDir}/pipeline_info/nf_core_mag_software_mqc_versions.yml"),
5871
).match()
5972
},
6073
{ assert snapshot(stable_name_qc, stable_path_qc ).match('qc') },
6174
{ assert snapshot(stable_name_assembly, stable_path_assembly).match('assembly') },
6275
{ assert snapshot(stable_name_binning, stable_path_binning ).match('binning') },
6376
{ assert snapshot(stable_name_multiqc, stable_path_multiqc ).match('multiqc') },
77+
{ assert snapshot(
78+
remove_phix_logs.collect {
79+
log -> (log.readLines().last() =~ /[0-9.]+% overall alignment rate/).find()
80+
},
81+
megahit_logs.collect {
82+
log -> (log.readLines().last() =~ /ALL DONE. Time elapsed: [0-9.]+ seconds/).find()
83+
},
84+
bowtie2_logs.collect {
85+
log -> (log.readLines().last() =~ /[0-9.]+% overall alignment rate/).find()
86+
},
87+
checkm2_logs.collect {
88+
log -> log.readLines().last().contains('CheckM2 finished successfully.')
89+
}
90+
).match('logs')
91+
},
92+
{ assert snapshot(
93+
checkm2_diamond_results.collect { results -> results.text.readLines().size() }
94+
).match('checkm2_diamond_results')
95+
}
6496
)
6597
}
6698
}

tests/test_alternatives.nf.test.snap

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"-profile test_alternatives": {
33
"content": [
4-
41,
4+
40,
55
{
66
"BOWTIE2_ASSEMBLY_ALIGN": {
77
"bowtie2": "2.4.2",
@@ -76,7 +76,7 @@
7676
"nf-test": "0.9.2",
7777
"nextflow": "25.04.6"
7878
},
79-
"timestamp": "2025-08-14T18:57:23.348145135"
79+
"timestamp": "2025-08-19T05:34:45.454821445"
8080
},
8181
"qc": {
8282
"content": [
@@ -103,7 +103,7 @@
103103
"nf-test": "0.9.2",
104104
"nextflow": "25.04.6"
105105
},
106-
"timestamp": "2025-08-15T17:19:55.404846039"
106+
"timestamp": "2025-08-19T05:48:02.545908468"
107107
},
108108
"assembly": {
109109
"content": [
@@ -126,7 +126,7 @@
126126
"nf-test": "0.9.2",
127127
"nextflow": "25.04.6"
128128
},
129-
"timestamp": "2025-08-15T17:59:00.017784737"
129+
"timestamp": "2025-08-19T05:48:02.627859864"
130130
},
131131
"binning": {
132132
"content": [
@@ -178,7 +178,7 @@
178178
"nf-test": "0.9.2",
179179
"nextflow": "25.04.6"
180180
},
181-
"timestamp": "2025-08-16T00:27:09.239614324"
181+
"timestamp": "2025-08-19T05:48:02.751413853"
182182
},
183183
"multiqc": {
184184
"content": [
@@ -326,6 +326,44 @@
326326
"nf-test": "0.9.2",
327327
"nextflow": "25.04.6"
328328
},
329-
"timestamp": "2025-08-16T00:16:39.223340186"
329+
"timestamp": "2025-08-19T05:48:02.887052224"
330+
},
331+
"logs": {
332+
"content": [
333+
[
334+
true,
335+
true
336+
],
337+
[
338+
true,
339+
true
340+
],
341+
[
342+
true,
343+
true,
344+
true,
345+
true
346+
],
347+
[
348+
true
349+
]
350+
],
351+
"meta": {
352+
"nf-test": "0.9.2",
353+
"nextflow": "25.04.6"
354+
},
355+
"timestamp": "2025-08-19T06:16:18.46461972"
356+
},
357+
"checkm2_diamond_results": {
358+
"content": [
359+
[
360+
806
361+
]
362+
],
363+
"meta": {
364+
"nf-test": "0.9.2",
365+
"nextflow": "25.04.6"
366+
},
367+
"timestamp": "2025-08-19T07:54:53.522803327"
330368
}
331369
}

0 commit comments

Comments
 (0)