Skip to content

Commit

Permalink
fixing tests testing fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyThiessen committed Mar 22, 2024
1 parent 0edd505 commit 23db32c
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 55 deletions.
4 changes: 2 additions & 2 deletions test/fixtures/samples_workflow_executions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ sample1_irida_next_example_new:

sample1_irida_next_example_completed:
sample_id: <%= ActiveRecord::FixtureSet.identify(:sample1, :uuid) %>
workflow_execution_id: <%= ActiveRecord::FixtureSet.identify(:irida_next_example_completed_with_samples, :uuid) %>
workflow_execution_id: <%= ActiveRecord::FixtureSet.identify(:irida_next_example_completed_c, :uuid) %>
samplesheet_params: {
"sample": <%= "Sample_#{ActiveRecord::FixtureSet.identify(:sample1, :uuid)}" %>,
"fastq_1": <%= "gid://irida/Attachment/#{ActiveRecord::FixtureSet.identify(:attachment1, :uuid)}" %>,
Expand All @@ -125,7 +125,7 @@ sample1_irida_next_example_completed:

sample2_irida_next_example_completed:
sample_id: <%= ActiveRecord::FixtureSet.identify(:sample2, :uuid) %>
workflow_execution_id: <%= ActiveRecord::FixtureSet.identify(:irida_next_example_completed_with_samples, :uuid) %>
workflow_execution_id: <%= ActiveRecord::FixtureSet.identify(:irida_next_example_completed_c, :uuid) %>
samplesheet_params: {
"sample": <%= "Sample_#{ActiveRecord::FixtureSet.identify(:sample2, :uuid)}" %>,
"fastq_1": <%= "gid://irida/Attachment/#{ActiveRecord::FixtureSet.identify(:attachment2, :uuid)}" %>,
Expand Down
115 changes: 69 additions & 46 deletions test/fixtures/workflow_executions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ irida_next_example_completed:
state: "completed"
blob_run_directory: "not a run dir"

irida_next_example_completed2:
irida_next_example_error:
metadata:
{
"workflow_name": "irida_next_example_completed",
"workflow_name": "irida_next_example_error",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -127,16 +127,15 @@ irida_next_example_completed2:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_completed"
run_id: "my_run_id_6"
workflow_url: "https://github.com/phac-nml/irida_next_example_error"
run_id: "my_run_id_7"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "completed"
blob_run_directory: "not a run dir"
state: "error"

irida_next_example_completed_with_samples:
irida_next_example_canceling:
metadata:
{
"workflow_name": "irida_next_example_completed",
"workflow_name": "irida_next_example_canceling",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -151,16 +150,15 @@ irida_next_example_completed_with_samples:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_completed"
run_id: "my_run_id_with_samples"
workflow_url: "https://github.com/phac-nml/irida_next_example_canceling"
run_id: "my_run_id_8"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "completed"
blob_run_directory: "not a run dir"
state: "canceling"

irida_next_example_error:
irida_next_example_canceled:
metadata:
{
"workflow_name": "irida_next_example_error",
"workflow_name": "irida_next_example_canceled",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -175,15 +173,15 @@ irida_next_example_error:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_error"
run_id: "my_run_id_7"
workflow_url: "https://github.com/phac-nml/irida_next_example_canceled"
run_id: "my_run_id_9"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "error"
state: "canceled"

irida_next_example_canceling:
irida_next_example_running:
metadata:
{
"workflow_name": "irida_next_example_canceling",
"workflow_name": "irida_next_example_running",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -198,15 +196,15 @@ irida_next_example_canceling:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_canceling"
run_id: "my_run_id_8"
workflow_url: "https://github.com/phac-nml/irida_next_example_running"
run_id: "my_run_id_10"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "canceling"
state: "running"

irida_next_example_canceled:
irida_next_example_queued:
metadata:
{
"workflow_name": "irida_next_example_canceled",
"workflow_name": "irida_next_example_queued",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -221,15 +219,35 @@ irida_next_example_canceled:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_canceled"
run_id: "my_run_id_9"
workflow_url: "https://github.com/phac-nml/irida_next_example_queued"
run_id: "my_run_id_11"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "canceled"
state: "queued"

irida_next_example_running:
irida_next_example_new:
metadata:
{ "workflow_name": "irida_next_example_new", "workflow_version": "1.0dev" }
workflow_params:
{
"workflow_name": "irida_next_example_running",
"-r": "dev",
"--input": "/blah/samplesheet.csv",
"--outdir": "/blah/output",
}
workflow_type: "DSL2"
workflow_type_version: "22.10.7"
tags: []
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_new"
run_id: "my_run_id_12"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "new"

irida_next_example_completed_a:
metadata:
{
"workflow_name": "irida_next_example_completed",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -244,15 +262,16 @@ irida_next_example_running:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_running"
run_id: "my_run_id_10"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "running"
workflow_url: "https://github.com/phac-nml/irida_next_example_completed"
run_id: "my_run_id_a"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:jeff_doe, :uuid) %>
state: "completed"
blob_run_directory: "not a run dir"

irida_next_example_queued:
irida_next_example_completed_b:
metadata:
{
"workflow_name": "irida_next_example_queued",
"workflow_name": "irida_next_example_completed",
"workflow_version": "1.0dev",
}
workflow_params:
Expand All @@ -267,14 +286,18 @@ irida_next_example_queued:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_queued"
run_id: "my_run_id_11"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "queued"
workflow_url: "https://github.com/phac-nml/irida_next_example_completed"
run_id: "my_run_id_b"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:jeff_doe, :uuid) %>
state: "completed"
blob_run_directory: "not a run dir"

irida_next_example_new:
irida_next_example_completed_c:
metadata:
{ "workflow_name": "irida_next_example_new", "workflow_version": "1.0dev" }
{
"workflow_name": "irida_next_example_completed",
"workflow_version": "1.0dev",
}
workflow_params:
{
"-r": "dev",
Expand All @@ -287,11 +310,11 @@ irida_next_example_new:
workflow_engine: "nextflow"
workflow_engine_version: ""
workflow_engine_parameters: { "engine": "nextflow", "execute_loc": "azure" }
workflow_url: "https://github.com/phac-nml/irida_next_example_new"
run_id: "my_run_id_12"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:john_doe, :uuid) %>
state: "new"

workflow_url: "https://github.com/phac-nml/irida_next_example_completed"
run_id: "my_run_id_c"
submitter_id: <%= ActiveRecord::FixtureSet.identify(:jeff_doe, :uuid) %>
state: "completed"
blob_run_directory: "not a run dir"

<% (1..25).each do |n| %>
workflow_execution<%= (n) %>:
Expand Down
14 changes: 7 additions & 7 deletions test/services/workflow_executions/completion_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CompletionServiceTest < ActiveStorageTestCase
def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
# normal/
# get a new secure token for each workflow execution
@workflow_execution_completed = workflow_executions(:irida_next_example_completed)
@workflow_execution_completed = workflow_executions(:irida_next_example_completed_a)
blob_run_directory_a = ActiveStorage::Blob.generate_unique_secure_token
@workflow_execution_completed.blob_run_directory = blob_run_directory_a

Expand All @@ -23,7 +23,7 @@ def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

# no_files/
# get a new secure token for each workflow execution
@workflow_execution_no_files = workflow_executions(:irida_next_example_completed2)
@workflow_execution_no_files = workflow_executions(:irida_next_example_completed_b)
blob_run_directory_b = ActiveStorage::Blob.generate_unique_secure_token
@workflow_execution_no_files.blob_run_directory = blob_run_directory_b

Expand All @@ -35,7 +35,7 @@ def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

# normal2/
# get a new secure token for each workflow execution
@workflow_execution_with_samples = workflow_executions(:irida_next_example_completed_with_samples)
@workflow_execution_with_samples = workflow_executions(:irida_next_example_completed_c)
blob_run_directory_c = ActiveStorage::Blob.generate_unique_secure_token
@workflow_execution_with_samples.blob_run_directory = blob_run_directory_c

Expand Down Expand Up @@ -77,7 +77,7 @@ def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

assert WorkflowExecutions::CompletionService.new(workflow_execution, {}).execute

assert_equal 'my_run_id_6', workflow_execution.run_id
assert_equal 'my_run_id_a', workflow_execution.run_id
assert_equal 1, workflow_execution.outputs.count
# original file blob should not be the same as the output file blob, but contain the same file
output_summary_file = workflow_execution.outputs[0]
Expand Down Expand Up @@ -106,7 +106,7 @@ def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

assert WorkflowExecutions::CompletionService.new(workflow_execution, {}).execute

assert_equal 'my_run_id_6', workflow_execution.run_id
assert_equal 'my_run_id_b', workflow_execution.run_id
# no files should be added to the run
assert_equal 0, workflow_execution.outputs.count

Expand All @@ -120,7 +120,7 @@ def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

assert WorkflowExecutions::CompletionService.new(workflow_execution, {}).execute

assert_equal 'my_run_id_with_samples', workflow_execution.run_id
assert_equal 'my_run_id_c', workflow_execution.run_id

assert_equal 2, workflow_execution.samples_workflow_executions.count
assert_equal 'sample1puid', workflow_execution.samples_workflow_executions[0].sample.puid
Expand Down Expand Up @@ -155,7 +155,7 @@ def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

assert WorkflowExecutions::CompletionService.new(workflow_execution, {}).execute

assert_equal 'my_run_id_with_samples', workflow_execution.run_id
assert_equal 'my_run_id_c', workflow_execution.run_id

metadata1 = { 'amr' => [{ 'end' => 5678, 'gene' => 'x', 'start' => 1234 },
{ 'end' => 2, 'gene' => 'y', 'start' => 1 }],
Expand Down

0 comments on commit 23db32c

Please sign in to comment.