From ae4c9766db9dbc972370bacbf2638f42e38a49f4 Mon Sep 17 00:00:00 2001 From: Toni Hermoso Pulido Date: Fri, 25 Oct 2024 17:57:26 +0200 Subject: [PATCH] starting to add test --- nextflow.config | 16 ++++++++++++++-- nf-test.config | 8 ++++++++ tests/main.nf.test | 20 ++++++++++++++++++++ tests/nextflow.config | 27 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 nf-test.config create mode 100644 tests/main.nf.test create mode 100644 tests/nextflow.config diff --git a/nextflow.config b/nextflow.config index 23d9639..39b6fc4 100644 --- a/nextflow.config +++ b/nextflow.config @@ -94,13 +94,14 @@ params { } process { - queue = 'long-sl7,short-sl7' + + // queue = 'long-sl7,short-sl7' cache = 'lenient' memory='4.5G' cpus='1' time='6h' scratch = false - containerOptions = { workflow.containerEngine == "docker" ? '-u $(id -u):$(id -g)': null} + // containerOptions = { workflow.containerEngine == "docker" ? '-u $(id -u):$(id -g)': null} container = 'perl:5.24-threaded-buster' withLabel: incr_time_cpus { @@ -176,6 +177,17 @@ profiles { shifter.enabled = false charliecloud.enabled = false } + // Default configuration for test - Change accordingly + test { + apptainer.enabled = true + apptainer.autoMounts = true + conda.enabled = false + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } // Original ExOrthist AWS Batch configuration // awsbatch { diff --git a/nf-test.config b/nf-test.config new file mode 100644 index 0000000..0567df1 --- /dev/null +++ b/nf-test.config @@ -0,0 +1,8 @@ +config { + + testsDir "tests" + workDir ".nf-test" + configFile "tests/nextflow.config" + profile "test" + +} diff --git a/tests/main.nf.test b/tests/main.nf.test new file mode 100644 index 0000000..7183d37 --- /dev/null +++ b/tests/main.nf.test @@ -0,0 +1,20 @@ +nextflow_pipeline { + + name "Test pipeline with default settings" + script "../main.nf" + + test("Params: default") { + + when { + params { + output = "$output" + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } +} diff --git a/tests/nextflow.config b/tests/nextflow.config new file mode 100644 index 0000000..7977a33 --- /dev/null +++ b/tests/nextflow.config @@ -0,0 +1,27 @@ + +/* +======================================================================================== + Nextflow config file for running tests +======================================================================================== +*/ + + +// Impose sensible resource limits for testing +// process { +// withName: '.*' { +// cpus = 2 +// memory = 3.GB +// time = 2.h +// } +// } + +// Impose same minimum Nextflow version as the pipeline for testing +manifest { + nextflowVersion = '!>=24.04.2' +} + +// Disable all Nextflow reporting options +timeline { enabled = false } +report { enabled = false } +trace { enabled = false } +dag { enabled = false }