diff --git a/modules/local/ena_webin_cli/main.nf b/modules/local/ena_webin_cli/main.nf index 25b12f4..21ad914 100644 --- a/modules/local/ena_webin_cli/main.nf +++ b/modules/local/ena_webin_cli/main.nf @@ -53,6 +53,10 @@ process ENA_WEBIN_CLI { # there was attempt to re-submit already submitted genome export STATUS="success" true + elif grep -q "Submission(s) validated successfully" "${prefix}_webin-cli.report"; then + # we ran with -validate flag + export STATUS="success" + true else export STATUS="failed" false diff --git a/modules/local/ena_webin_cli/main.nf.test b/modules/local/ena_webin_cli/main.nf.test new file mode 100644 index 0000000..4db38c6 --- /dev/null +++ b/modules/local/ena_webin_cli/main.nf.test @@ -0,0 +1,86 @@ +nextflow_process { + + name "Test Process ENA_WEBIN_CLI" + script "modules/local/ena_webin_cli/main.nf" + process "ENA_WEBIN_CLI" + + test("Run validate with no failures") { + + when { + params { + webincli_submit = false + } + process { + """ + input[0] = Channel.of( + tuple( + [id: 'lachnospira_eligens'], + file("https://github.com/nf-core/test-datasets/raw/refs/heads/seqsubmit/test_data/bins/bin_lachnospira_eligens.fa.gz", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/refs/heads/seqsubmit/test_data/lachnospira_eligens.manifest", checkIfExists: true) + ) + ) + """ + } + } + + then { + assertAll { + assert process.success + assert process.out.upload_status[0][1] == 'success' + assert path(process.out.webin_report[0][1]).readLines()[0].contains("Submission(s) validated successfully") + assert snapshot(process.out.versions).match() + } + } + + } + + test("Run push with no failures") { + setup { + run("GENERATE_TEST_DATA") { + script "./setup_test.nf" + process { + """ + input[0] = Channel.of( + file("https://github.com/nf-core/test-datasets/raw/refs/heads/seqsubmit/test_data/lachnospira_eligens.manifest", checkIfExists: true) + ) + """ + } + } + + } + + when { + params { + webincli_submit = true + test_upload = true + } + process { + """ + def fasta = file("https://github.com/nf-core/test-datasets/raw/refs/heads/seqsubmit/test_data/bins/bin_lachnospira_eligens.fa.gz", checkIfExists: true) + + input[0] = GENERATE_TEST_DATA.out.test_manifest.map { manifest -> + tuple( + [id: 'lachnospira_eligens'], + fasta, + file(manifest) + ) + } + """ + } + } + + then { + assertAll { + assert process.success + assert process.out.upload_status[0][1] == 'success' + assert snapshot(process.out.versions).match() + assert path(process.out.webin_report[0][1]).readLines()[1].contains("Submission(s) validated successfully") + assert path(process.out.webin_report[0][1]).readLines()[5].contains("The submission has been completed successfully") + assert path(process.out.webin_report[0][1]).readLines()[6].contains("This was a TEST submission(s)") + + } + } + + } + +} diff --git a/modules/local/ena_webin_cli/main.nf.test.snap b/modules/local/ena_webin_cli/main.nf.test.snap new file mode 100644 index 0000000..ef27c95 --- /dev/null +++ b/modules/local/ena_webin_cli/main.nf.test.snap @@ -0,0 +1,26 @@ +{ + "Run validate with no failures": { + "content": [ + [ + "versions.yml:md5,a38fb03bead632d71062a101d7889ded" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.04.8" + }, + "timestamp": "2025-10-29T14:09:00.202532371" + }, + "Run push with no failures": { + "content": [ + [ + "versions.yml:md5,a38fb03bead632d71062a101d7889ded" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.04.8" + }, + "timestamp": "2025-10-29T14:01:42.491885321" + } +} \ No newline at end of file diff --git a/modules/local/ena_webin_cli/setup_test.nf b/modules/local/ena_webin_cli/setup_test.nf new file mode 100644 index 0000000..9b71031 --- /dev/null +++ b/modules/local/ena_webin_cli/setup_test.nf @@ -0,0 +1,17 @@ +process GENERATE_TEST_DATA { + label 'process_low' + container "quay.io/biocontainers/ena-webin-cli:9.0.1--hdfd78af_1" + + input: + path(manifest_template) + + output: + path("*.manifest"), emit: test_manifest + + script: + """ + timestamp="\$(date +%s)" + + sed -E "s/^(ASSEMBLYNAME\t[^\t]+)/\\1_\${timestamp}/" "${manifest_template}" > "lachnospira_eligens_dynamic_fixture.manifest" + """ +}