Improvements for mule job handler testing. Ensure that the server

running the job is a mule. Added a test tool that will write Galaxy
app.config attributes to the output dataset.
This commit is contained in:
Nate Coraor
2017-08-31 14:30:46 -04:00
parent 3477906dc5
commit 3f0082515a
4 changed files with 47 additions and 2 deletions
+5
View File
@@ -21,6 +21,7 @@ import nose.core
import nose.loader
import nose.plugins.manager
from paste import httpserver
from six.moves import shlex_quote
from functional import database_contexts
from galaxy.app import UniverseApplication as GalaxyUniverseApplication
@@ -657,6 +658,8 @@ def launch_uwsgi(kwargs, tempdir, prefix=DEFAULT_CONFIG_PREFIX, config_object=No
yaml_config_path,
"--module",
"galaxy.webapps.galaxy.buildapp:uwsgi_app_factory()",
"--enable-threads",
"--die-on-term",
]
handle_uwsgi_cli_command = getattr(
@@ -665,6 +668,8 @@ def launch_uwsgi(kwargs, tempdir, prefix=DEFAULT_CONFIG_PREFIX, config_object=No
if handle_uwsgi_cli_command is not None:
handle_uwsgi_cli_command(uwsgi_command)
# we don't want to quote every argument but we don't want to print unquoted ones either, so do this
log.info("Starting uwsgi with command line: %s", ' '.join([shlex_quote(x) for x in uwsgi_command]))
p = subprocess.Popen(
uwsgi_command,
cwd=galaxy_root,
+25
View File
@@ -0,0 +1,25 @@
<tool id="config_vars" name="config_vars" version="1.0.0">
<command>
#if str($var) != "__test_key":
echo "#echo getattr($__app__.config, str($var))#" > $out_file1
#else:
echo "__test_value" > $out_file1
#end if
</command>
<inputs>
<param name="var" value="__test_key" type="text" />
</inputs>
<outputs>
<data name="out_file1" format="txt" />
</outputs>
<tests>
<test>
<param name="var" value="__test_key" />
<output name="out_file1">
<assert_contents>
<has_line line="__test_value" />
</assert_contents>
</output>
</test>
</tests>
</tool>
@@ -118,6 +118,7 @@
<tool file="cheetah_problem_unbound_var_input.xml" />
<tool file="cheetah_problem_syntax_error.xml" />
<tool file="python_environment_problem.xml" />
<tool file="config_vars.xml" />
<tool file="multiple_versions_v01.xml" />
<tool file="multiple_versions_v02.xml" />
+16 -2
View File
@@ -17,13 +17,27 @@ class MulesAsJobHandlersIntegrationTestCase(integration_util.IntegrationTestCase
@classmethod
def handle_uwsgi_cli_command(cls, command):
command.extend([
"--py-call-osafterfork",
"--mule=lib/galaxy/main.py",
"--farm=job-handlers:1",
])
def test_tool_simple_constructs(self):
tool_id = 'config_vars'
expect_server_name = 'main.mule'
dataset_populator = DatasetPopulator(self.galaxy_interactor)
history_id = dataset_populator.new_history()
dataset_populator.new_dataset(
history_id, contents="test 1 2 3", file_type="txt", wait=True
payload = dataset_populator.run_tool(
tool_id=tool_id,
inputs={'var': 'server_name'},
history_id=history_id,
)
dataset_id = payload['outputs'][0]['id']
dataset_populator.wait_for_dataset(history_id, dataset_id, assert_ok=True)
output = dataset_populator.get_history_dataset_content(history_id, dataset_id=dataset_id).strip()
assert output.startswith(expect_server_name), (
"Job handler's server name '{output}' does not start with expected string '{expected}'".format(
output=output,
expected=expect_server_name,
)
)