Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion planemo/commands/cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"instances to limit generated traffic.",
default="0",
)
@options.galaxy_target_options()
@options.serve_option()
@options.galaxy_run_options()
@options.galaxy_config_options()
@options.test_options()
@options.engine_options()
Expand Down
18 changes: 18 additions & 0 deletions planemo/engine/test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import os

from planemo.engine import (
engine_context,
)
from planemo.galaxy import galaxy_config
from planemo.galaxy import galaxy_serve
from planemo.galaxy.api import (
DEFAULT_ADMIN_API_KEY
)
from planemo.galaxy.config import _find_test_data
from planemo.galaxy.ephemeris_sleep import sleep
from planemo.galaxy.test import (
handle_reports_and_summary,
run_in_config,
Expand All @@ -15,6 +22,17 @@

def test_runnables(ctx, runnables, original_paths=None, **kwds):
"""Return exit code indicating test or failure."""
if kwds.get("serve"):
kwds["engine"] = "external_galaxy"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not this only works with that engine type in the option help?

kwds["galaxy_url"] = ''.join(("http://", kwds["host"], ":", kwds["port"]))
kwds["galaxy_admin_key"] = kwds["galaxy_admin_key"] or DEFAULT_ADMIN_API_KEY
pid = os.fork()
if pid == 0:
sleep(kwds["galaxy_url"], verbose=ctx.verbose, timeout=500)
else:
galaxy_serve(ctx, runnables, **kwds)
exit(1)
Comment on lines +29 to +38
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forking in the presence of threads seems brittle. With #1232 we're removing the run_tests.sh mode, so you could just sleep infinitely in cmd_test.sh / cmd_shed_test.sh after merging this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mvdbeek, I'll have another look when #1232 gets merged.


engine_type = kwds["engine"]
test_engine_testable = {RunnableType.galaxy_tool, RunnableType.galaxy_datamanager, RunnableType.directory}
enable_test_engines = any(r.type not in test_engine_testable for r in runnables)
Expand Down
9 changes: 9 additions & 0 deletions planemo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,15 @@ def no_cleanup_option():
)


def serve_option():
return planemo_option(
"--serve",
is_flag=True,
default=False,
help=("Continue serving Galaxy instance after testing.")
)


def docker_enable_option():
return planemo_option(
"--docker/--no_docker",
Expand Down