Skip to content

Commit 705c56b

Browse files
committed
use log.warn, and update tests
1 parent 43a4f37 commit 705c56b

3 files changed

Lines changed: 1011 additions & 48 deletions

File tree

tests/NovaSeq6000.main_subsample.nf.test

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ nextflow_pipeline {
7373
)
7474
}
7575
}
76+
7677
test("NovaSeq6000 data test sample size exceeds available reads") {
78+
tag "warning"
7779

7880
when {
7981
config "./NovaSeq6000.main_subsample.nf.test.config"
@@ -84,18 +86,29 @@ nextflow_pipeline {
8486
}
8587

8688
then {
87-
def warn_messages = [
88-
"Warning: Requested sample_size (120) is larger than available reads in Undetermined_5 (100). Pipeline will continue with 100 reads.",
89-
"Warning: Requested sample_size (120) is larger than available reads in SampleA_2 (100). Pipeline will continue with 100 reads.",
90-
"Warning: Requested sample_size (120) is larger than available reads in sampletest_4 (100). Pipeline will continue with 100 reads.",
91-
"Warning: Requested sample_size (120) is larger than available reads in Sample23_3 (100). Pipeline will continue with 100 reads.",
92-
"Warning: Requested sample_size (120) is larger than available reads in Sample1_1 (100). Pipeline will continue with 100 reads."
93-
]
89+
// stable_name: All files + folders in ${params.outdir}/ with a stable name
90+
def stable_name = getAllFilesFromDir(
91+
params.outdir,
92+
relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}']
93+
)
94+
// stable_path: All files in ${params.outdir}/ with stable content
95+
def stable_path = getAllFilesFromDir(
96+
params.outdir,
97+
ignoreFile: 'tests/.nftignore'
98+
)
9499
assert workflow.success
95-
for ( msg in warn_messages ) {
96-
// Read warning from stdout as nf-test does not capture log messages
97-
assert workflow.stdout.contains(msg)
98-
}
100+
assertAll(
101+
{ assert snapshot(
102+
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
103+
removeNextflowVersion("$outputDir/pipeline_info/nf_core_seqinspector_software_mqc_versions.yml"),
104+
// All stable path names, with a relative path
105+
stable_name,
106+
// All files with stable contents
107+
stable_path,
108+
// get all messages containing Requested sample_size (120)
109+
filterNextflowOutput(workflow.stdout + workflow.stderr, ignore: ['Downloading plugin'], include:['Requested sample_size (120)'])
110+
).match() }
111+
)
99112
}
100113
}
101114
}

0 commit comments

Comments
 (0)