From e04c3e994a6c33f33acb6bfa68aeb7ca4789cdc0 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Tue, 28 Nov 2023 17:46:25 +0000 Subject: [PATCH 01/11] Start with tests for the gantt plots --- .../local/plot_run_gantt/tests/.nf-test.log | 4 ++ .../local/plot_run_gantt/tests/main.nf.test | 42 +++++++++++++++++++ .../plot_run_gantt/tests/main.nf.test.snap | 10 +++++ .../plot_run_gantt/tests/nextflow.config | 1 + modules/local/plot_run_gantt/tests/tags.yml | 2 + 5 files changed, 59 insertions(+) create mode 100644 modules/local/plot_run_gantt/tests/.nf-test.log create mode 100644 modules/local/plot_run_gantt/tests/main.nf.test create mode 100644 modules/local/plot_run_gantt/tests/main.nf.test.snap create mode 100644 modules/local/plot_run_gantt/tests/nextflow.config create mode 100644 modules/local/plot_run_gantt/tests/tags.yml diff --git a/modules/local/plot_run_gantt/tests/.nf-test.log b/modules/local/plot_run_gantt/tests/.nf-test.log new file mode 100644 index 0000000..d9a4418 --- /dev/null +++ b/modules/local/plot_run_gantt/tests/.nf-test.log @@ -0,0 +1,4 @@ +Nov-28 09:37:34.522 [main] INFO com.askimed.nf.test.App - nf-test 0.8.1 +Nov-28 09:37:34.552 [main] INFO com.askimed.nf.test.App - Arguments: [test, --profile=conda, --tap=test.tap, --verbose] +Nov-28 09:37:34.555 [main] WARN com.askimed.nf.test.commands.RunTestsCommand - No nf-test config file found. +Nov-28 09:37:34.555 [main] ERROR com.askimed.nf.test.commands.RunTestsCommand - No tests ot directories found containing test files. diff --git a/modules/local/plot_run_gantt/tests/main.nf.test b/modules/local/plot_run_gantt/tests/main.nf.test new file mode 100644 index 0000000..27d22a1 --- /dev/null +++ b/modules/local/plot_run_gantt/tests/main.nf.test @@ -0,0 +1,42 @@ +nextflow_process { + + name "Test Process PLOT_RUN_GANTT" + script "../main.nf" + process "PLOT_RUN_GANTT" + config "./nextflow.config" + + tag "modules" + tag "modules_local" + tag "plot_run_gantt" + + test("Should run without failures") { + + setup { + run("SEQERA_RUNS_DUMP") { + script "../../seqera_runs_dump/main.nf" + process { + """ + input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase'] + """ + } + } + } + + when { + process { + """ + input[0] = SEQERA_RUNS_DUMP.out.run_dump.join(SEQERA_RUNS_DUMP.out.workflow_json).map { meta, run_dump, json -> [ meta + [ pipeline : getWorkflowName(json) ], run_dump ] } + """ + } + } + + then { + assertAll( + { assert snapshot(process.out.html).match() }, + { assert process.success } + ) + } + + } + +} diff --git a/modules/local/plot_run_gantt/tests/main.nf.test.snap b/modules/local/plot_run_gantt/tests/main.nf.test.snap new file mode 100644 index 0000000..876ab7f --- /dev/null +++ b/modules/local/plot_run_gantt/tests/main.nf.test.snap @@ -0,0 +1,10 @@ +{ + "Should run without failures": { + "content": [ + [ + + ] + ], + "timestamp": "2023-11-28T16:52:51.371307827" + } +} \ No newline at end of file diff --git a/modules/local/plot_run_gantt/tests/nextflow.config b/modules/local/plot_run_gantt/tests/nextflow.config new file mode 100644 index 0000000..ddc637d --- /dev/null +++ b/modules/local/plot_run_gantt/tests/nextflow.config @@ -0,0 +1 @@ +process { withName: 'SEQERA_RUNS_DUMP' { container = 'public.ecr.aws/seqera-labs/wave/containers:tower-cli-0.9.0--2cb0f2e9d85d026b' } } diff --git a/modules/local/plot_run_gantt/tests/tags.yml b/modules/local/plot_run_gantt/tests/tags.yml new file mode 100644 index 0000000..ce481c7 --- /dev/null +++ b/modules/local/plot_run_gantt/tests/tags.yml @@ -0,0 +1,2 @@ +plot_run_gantt: + - modules/local/plot_run_gantt/** From 65a221ba13e32c6dc61e4d07daac0bdbc1869548 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 10:19:30 +0000 Subject: [PATCH 02/11] Fix snapshotting --- .../local/seqera_runs_dump/tests/main.nf.test | 8 +++-- .../seqera_runs_dump/tests/main.nf.test.snap | 36 ++++++++----------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/modules/local/seqera_runs_dump/tests/main.nf.test b/modules/local/seqera_runs_dump/tests/main.nf.test index 4697a18..0f30b7c 100644 --- a/modules/local/seqera_runs_dump/tests/main.nf.test +++ b/modules/local/seqera_runs_dump/tests/main.nf.test @@ -20,11 +20,13 @@ nextflow_process { } then { - def dumpFiles = path(process.out.run_dump.get(0).get(1)).toFile().listFiles().sort() + def dumpFiles = file(process.out.run_dump.get(0).get(1)).listFiles() assertAll( - { assert snapshot(process.out.workflow_json).match() }, - { assert snapshot(workflow, dumpFiles.findAll { ! it.name.matches('workflow-launch.json')}).match()}, + { assert snapshot( + dumpFiles.grep { file -> ! file.name.matches("workflow-launch.json") }, + process.out.workflow_json + ).match()}, { assert dumpFiles.find { it.name.matches('workflow-launch.json')}.exists()}, { assert process.success } ) diff --git a/modules/local/seqera_runs_dump/tests/main.nf.test.snap b/modules/local/seqera_runs_dump/tests/main.nf.test.snap index f7979a0..77b89bc 100644 --- a/modules/local/seqera_runs_dump/tests/main.nf.test.snap +++ b/modules/local/seqera_runs_dump/tests/main.nf.test.snap @@ -1,33 +1,25 @@ { "Should run without failures": { "content": [ - { - "stderr": [ - - ], - "errorReport": null, - "exitStatus": 0, - "failed": false, - "stdout": [ - - ], - "errorMessage": null, - "trace": { - "tasksFailed": 0, - "tasksCount": 1, - "tasksSucceeded": 1 - }, - "name": "workflow", - "success": true - }, [ - "service-info.json:md5,0a2624c21efb65b85e37fa3d07903dcc", "workflow-load.json:md5,4f02d5a24ab89aa648cd4346785c8f2c", "workflow-metrics.json:md5,70dd1af37145c8c2d23836fe850622e7", "workflow-tasks.json:md5,577a7472816b7729012a9291d97ff150", - "workflow.json:md5,34db0e39f0246670eac77c7a5e9093c9" + "workflow.json:md5,34db0e39f0246670eac77c7a5e9093c9", + "service-info.json:md5,0a2624c21efb65b85e37fa3d07903dcc" + ], + [ + [ + { + "id": "4Bi5xBK6E2Nbhj", + "workspace": "community/showcase", + "runName": "crazy_wiles", + "workDir": "s3://nf-tower-bucket/scratch/4Bi5xBK6E2Nbhj" + }, + "workflow.json:md5,34db0e39f0246670eac77c7a5e9093c9" + ] ] ], - "timestamp": "2023-11-28T17:27:26.539517301" + "timestamp": "2023-11-29T10:13:31.623951214" } } \ No newline at end of file From 663406746ca696ec7efa0425968473000a05db30 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 15:02:04 +0000 Subject: [PATCH 03/11] restore snap line --- modules/local/seqera_runs_dump/tests/main.nf.test.snap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/local/seqera_runs_dump/tests/main.nf.test.snap b/modules/local/seqera_runs_dump/tests/main.nf.test.snap index 5c24938..89dbf49 100644 --- a/modules/local/seqera_runs_dump/tests/main.nf.test.snap +++ b/modules/local/seqera_runs_dump/tests/main.nf.test.snap @@ -2,6 +2,7 @@ "Should run without failures": { "content": [ [ + "service-info.json:md5,0a2624c21efb65b85e37fa3d07903dcc", "workflow-load.json:md5,4f02d5a24ab89aa648cd4346785c8f2c", "workflow-metrics.json:md5,70dd1af37145c8c2d23836fe850622e7", "workflow-tasks.json:md5,577a7472816b7729012a9291d97ff150", @@ -11,4 +12,4 @@ ], "timestamp": "2023-11-29T13:34:09.5038157" } -} \ No newline at end of file +} From fb6231c86b61266c5638a08a0de22fa26bfe967f Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 15:04:59 +0000 Subject: [PATCH 04/11] Reset snap --- modules/local/seqera_runs_dump/tests/main.nf.test.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/local/seqera_runs_dump/tests/main.nf.test.snap b/modules/local/seqera_runs_dump/tests/main.nf.test.snap index 89dbf49..b769ba3 100644 --- a/modules/local/seqera_runs_dump/tests/main.nf.test.snap +++ b/modules/local/seqera_runs_dump/tests/main.nf.test.snap @@ -12,4 +12,4 @@ ], "timestamp": "2023-11-29T13:34:09.5038157" } -} +} \ No newline at end of file From b8e39afedb3a98adf11c7824a43941ff75f42174 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 15:05:33 +0000 Subject: [PATCH 05/11] Don't need log --- modules/local/plot_run_gantt/tests/.nf-test.log | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 modules/local/plot_run_gantt/tests/.nf-test.log diff --git a/modules/local/plot_run_gantt/tests/.nf-test.log b/modules/local/plot_run_gantt/tests/.nf-test.log deleted file mode 100644 index d9a4418..0000000 --- a/modules/local/plot_run_gantt/tests/.nf-test.log +++ /dev/null @@ -1,4 +0,0 @@ -Nov-28 09:37:34.522 [main] INFO com.askimed.nf.test.App - nf-test 0.8.1 -Nov-28 09:37:34.552 [main] INFO com.askimed.nf.test.App - Arguments: [test, --profile=conda, --tap=test.tap, --verbose] -Nov-28 09:37:34.555 [main] WARN com.askimed.nf.test.commands.RunTestsCommand - No nf-test config file found. -Nov-28 09:37:34.555 [main] ERROR com.askimed.nf.test.commands.RunTestsCommand - No tests ot directories found containing test files. From 5953d53c15bbea616aa6706ef0326f0377e8be70 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 15:35:41 +0000 Subject: [PATCH 06/11] Update gantt plot tests --- modules/local/plot_run_gantt/tests/main.nf.test | 7 +++++-- .../local/plot_run_gantt/tests/main.nf.test.snap | 13 +++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/local/plot_run_gantt/tests/main.nf.test b/modules/local/plot_run_gantt/tests/main.nf.test index 27d22a1..13c9faa 100644 --- a/modules/local/plot_run_gantt/tests/main.nf.test +++ b/modules/local/plot_run_gantt/tests/main.nf.test @@ -16,7 +16,9 @@ nextflow_process { script "../../seqera_runs_dump/main.nf" process { """ - input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase'] + //input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase'] + input[0] = ['id': 'QymWt9jmaWFEu', 'workspace': 'scidev/testing'] + input[1] = "https://api.tower.nf" """ } } @@ -24,8 +26,9 @@ nextflow_process { when { process { + """ - input[0] = SEQERA_RUNS_DUMP.out.run_dump.join(SEQERA_RUNS_DUMP.out.workflow_json).map { meta, run_dump, json -> [ meta + [ pipeline : getWorkflowName(json) ], run_dump ] } + input[0] = SEQERA_RUNS_DUMP.out.run_dump """ } } diff --git a/modules/local/plot_run_gantt/tests/main.nf.test.snap b/modules/local/plot_run_gantt/tests/main.nf.test.snap index 876ab7f..c61fea7 100644 --- a/modules/local/plot_run_gantt/tests/main.nf.test.snap +++ b/modules/local/plot_run_gantt/tests/main.nf.test.snap @@ -2,9 +2,18 @@ "Should run without failures": { "content": [ [ - + [ + { + "id": "QymWt9jmaWFEu", + "workspace": "scidev/testing", + "runName": "sharp_kare", + "workDir": "s3://scidev-eu-west-1/scratch/QymWt9jmaWFEu", + "projectName": "nextflow-io/hello" + }, + "QymWt9jmaWFEu_gantt.html:md5,eee6e1bfe9994fc5c4cb7e8ab05827aa" + ] ] ], - "timestamp": "2023-11-28T16:52:51.371307827" + "timestamp": "2023-11-29T15:35:00.184419966" } } \ No newline at end of file From c83456bf61f3a8b367745592f399e4eb9a0020d0 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 15:37:32 +0000 Subject: [PATCH 07/11] appease eclint --- modules/local/plot_run_gantt/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/local/plot_run_gantt/tests/main.nf.test b/modules/local/plot_run_gantt/tests/main.nf.test index 13c9faa..d7f45c6 100644 --- a/modules/local/plot_run_gantt/tests/main.nf.test +++ b/modules/local/plot_run_gantt/tests/main.nf.test @@ -29,7 +29,7 @@ nextflow_process { """ input[0] = SEQERA_RUNS_DUMP.out.run_dump - """ + """ } } From 76c6748745c86b5be120611a74b42008cb256aeb Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 16:28:55 +0000 Subject: [PATCH 08/11] [skip ci] we'll need to check content --- modules/local/plot_run_gantt/tests/main.nf.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/local/plot_run_gantt/tests/main.nf.test b/modules/local/plot_run_gantt/tests/main.nf.test index d7f45c6..d164505 100644 --- a/modules/local/plot_run_gantt/tests/main.nf.test +++ b/modules/local/plot_run_gantt/tests/main.nf.test @@ -16,8 +16,8 @@ nextflow_process { script "../../seqera_runs_dump/main.nf" process { """ - //input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase'] - input[0] = ['id': 'QymWt9jmaWFEu', 'workspace': 'scidev/testing'] + input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase'] + //input[0] = ['id': 'QymWt9jmaWFEu', 'workspace': 'scidev/testing'] input[1] = "https://api.tower.nf" """ } @@ -35,7 +35,7 @@ nextflow_process { then { assertAll( - { assert snapshot(process.out.html).match() }, + { assert path(process.out.html.get(0).get(1)).getText().contains("i-019d5467c1b3ca3d2") }, { assert process.success } ) } From 0a5d0bdcd915bcd57b28b098ae1d21c4a2ad4e58 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 16:57:21 +0000 Subject: [PATCH 09/11] Fix gantt tests --- modules/local/plot_run_gantt/tests/main.nf.test | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/local/plot_run_gantt/tests/main.nf.test b/modules/local/plot_run_gantt/tests/main.nf.test index d164505..372198b 100644 --- a/modules/local/plot_run_gantt/tests/main.nf.test +++ b/modules/local/plot_run_gantt/tests/main.nf.test @@ -17,7 +17,6 @@ nextflow_process { process { """ input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase'] - //input[0] = ['id': 'QymWt9jmaWFEu', 'workspace': 'scidev/testing'] input[1] = "https://api.tower.nf" """ } @@ -35,7 +34,7 @@ nextflow_process { then { assertAll( - { assert path(process.out.html.get(0).get(1)).getText().contains("i-019d5467c1b3ca3d2") }, + { assert path(process.out.html.get(0).get(1)).getText().contains("GANTT plot for run: 4Bi5xBK6E2Nbhj") }, { assert process.success } ) } From 7675c8fc74f49e392d413aa297417249f2bd5921 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 16:58:36 +0000 Subject: [PATCH 10/11] Don't need snapshot --- .../plot_run_gantt/tests/main.nf.test.snap | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 modules/local/plot_run_gantt/tests/main.nf.test.snap diff --git a/modules/local/plot_run_gantt/tests/main.nf.test.snap b/modules/local/plot_run_gantt/tests/main.nf.test.snap deleted file mode 100644 index c61fea7..0000000 --- a/modules/local/plot_run_gantt/tests/main.nf.test.snap +++ /dev/null @@ -1,19 +0,0 @@ -{ - "Should run without failures": { - "content": [ - [ - [ - { - "id": "QymWt9jmaWFEu", - "workspace": "scidev/testing", - "runName": "sharp_kare", - "workDir": "s3://scidev-eu-west-1/scratch/QymWt9jmaWFEu", - "projectName": "nextflow-io/hello" - }, - "QymWt9jmaWFEu_gantt.html:md5,eee6e1bfe9994fc5c4cb7e8ab05827aa" - ] - ] - ], - "timestamp": "2023-11-29T15:35:00.184419966" - } -} \ No newline at end of file From f3f9735f006ea8592c39125a6fe3720e1cc3ac9d Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 29 Nov 2023 17:07:16 +0000 Subject: [PATCH 11/11] Fix container config --- modules/local/plot_run_gantt/tests/nextflow.config | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/local/plot_run_gantt/tests/nextflow.config b/modules/local/plot_run_gantt/tests/nextflow.config index ddc637d..a7b7f88 100644 --- a/modules/local/plot_run_gantt/tests/nextflow.config +++ b/modules/local/plot_run_gantt/tests/nextflow.config @@ -1 +1,2 @@ process { withName: 'SEQERA_RUNS_DUMP' { container = 'public.ecr.aws/seqera-labs/wave/containers:tower-cli-0.9.0--2cb0f2e9d85d026b' } } +process { withName: 'PLOT_RUN_GANTT' { container = 'quay.io/seqeralabs/nf-aggregate:click-8.0.1_pandas-1.1.5_plotly_express-0.4.1_typing-3.10.0.0--342dabfe6548a051' } }