Skip to content

Commit 967f32f

Browse files
committed
[Luna] Add test for CLI parameter override of paramsheet values
Test verifies that CLI flags (--round_digits 5) correctly override paramsheet values (round_digits: 3) when using --paramset. Two test cases: 1. CLI override: --round_digits 5 should take precedence over paramsheet 2. No override: paramsheet value (3) should be used This validates the desired parameter priority: CLI flags > paramsheet > defaults Related to issue nf-core#472 and PR nf-core#623.
1 parent d280b4c commit 967f32f

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
nextflow_pipeline {
2+
3+
name "Test CLI parameter override of paramsheet values"
4+
script "../main.nf"
5+
tag "cli_override"
6+
tag "pipeline"
7+
8+
test("CLI flag overrides paramsheet - round_digits") {
9+
10+
when {
11+
params {
12+
outdir = "$outputDir"
13+
paramsheet = "${projectDir}/conf/test_paramsheet.yaml"
14+
paramset_name = "deseq2_rnaseq_gsea"
15+
// Paramsheet sets round_digits: 3, but CLI should override to 5
16+
round_digits = 5
17+
}
18+
}
19+
20+
then {
21+
// stable_name: All files + folders in ${params.outdir}/ with a stable name
22+
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
23+
// stable_path: All files in ${params.outdir}/ with stable content
24+
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
25+
assertAll(
26+
{ assert workflow.success},
27+
{ assert snapshot(
28+
// Number of successful tasks
29+
workflow.trace.succeeded().size(),
30+
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
31+
removeNextflowVersion("$outputDir/pipeline_info/nf_core_differentialabundance_software_versions.yml"),
32+
// All stable path name, with a relative path
33+
stable_name,
34+
// All files with stable contents
35+
stable_path
36+
).match() }
37+
)
38+
}
39+
}
40+
41+
test("Paramsheet value without CLI override - round_digits") {
42+
// This test runs the same paramset but WITHOUT the CLI override
43+
// to verify that the paramsheet value (3) is used by default
44+
45+
when {
46+
params {
47+
outdir = "$outputDir"
48+
paramsheet = "${projectDir}/conf/test_paramsheet.yaml"
49+
paramset_name = "deseq2_rnaseq_gsea"
50+
// No round_digits override - should use paramsheet value of 3
51+
}
52+
}
53+
54+
then {
55+
// stable_name: All files + folders in ${params.outdir}/ with a stable name
56+
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
57+
// stable_path: All files in ${params.outdir}/ with stable content
58+
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
59+
assertAll(
60+
{ assert workflow.success},
61+
{ assert snapshot(
62+
// Number of successful tasks
63+
workflow.trace.succeeded().size(),
64+
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
65+
removeNextflowVersion("$outputDir/pipeline_info/nf_core_differentialabundance_software_versions.yml"),
66+
// All stable path name, with a relative path
67+
stable_name,
68+
// All files with stable contents
69+
stable_path
70+
).match() }
71+
)
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)