Skip to content

Commit

Permalink
Add integration test for ignoring invalid resource request in tool state
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Aug 22, 2023
1 parent cb35441 commit bd839e9
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/integration/dummy_job_resource_parameters.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<parameters>
<param label="Compute Resource" name="multi_compute_resource" type="select"
help="Need help selecting a compute resource? Options and limits are explained in detail &lt;a href='https://galaxyproject.org/main/' target='_blank'&gt;in the Galaxy Hub&lt;/a&gt;">
<option value="does not matter">Galaxy cluster</option>
<option value="or this">Jetstream 2</option>
</param>
</parameters>
22 changes: 22 additions & 0 deletions test/integration/job_resource_error_recovery_job_conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# job config that fails submission if job resource parameters are requested
runners:
local:
load: galaxy.jobs.runners.local:LocalJobRunner
workers: 1
dynamic:
rules_module: integration.job_resource_rules

execution:
default: initial_destination
environments:
initial_destination:
runner: dynamic
type: python
function: local_or_exception
local:
runner: local

tools:
- class: local
environment: local
resources: upload
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def local_or_exception(resource_params):
"""Build environment that fails if resource_params are passed."""
if resource_params:
raise Exception("boo!")
return "local"
43 changes: 43 additions & 0 deletions test/integration/test_job_resource_error_recovery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os

from galaxy_test.base.populators import (
DatasetPopulator,
WorkflowPopulator,
)
from galaxy_test.driver import integration_util

SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
JOB_RESOURCES_CONFIG_FILE = os.path.join(SCRIPT_DIRECTORY, "dummy_job_resource_parameters.xml")
JOB_CONFIG = os.path.join(SCRIPT_DIRECTORY, "job_resource_error_recovery_job_conf.yml")


class TestJobRecoveryBeforeHandledIntegration(integration_util.IntegrationTestCase):
dataset_populator: DatasetPopulator
framework_tool_and_types = True

def setUp(self) -> None:
super().setUp()
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
self.workflow_populator = WorkflowPopulator(self.galaxy_interactor)

@classmethod
def handle_galaxy_config_kwds(cls, config) -> None:
super().handle_galaxy_config_kwds(config)
config["job_config_file"] = JOB_CONFIG
config["job_resource_params_file"] = JOB_RESOURCES_CONFIG_FILE

def test_recovers_from_job_resource_errors(self):
with self.dataset_populator.test_history() as history_id:
self.workflow_populator.run_workflow(
"""
class: GalaxyWorkflow
steps:
simple_step:
tool_id: create_2
tool_state:
__job_resource:
__job_resource__select: 'yes'
cores: '32'
""",
history_id=history_id,
)

0 comments on commit bd839e9

Please sign in to comment.