Make symlinks in tool tree work for planemo test#988
Make symlinks in tool tree work for planemo test#988jmchilton merged 3 commits intogalaxyproject:masterfrom
Conversation
e7b8c85 to
e0987df
Compare
Fixes galaxyproject#857 and galaxyproject#865 Symlinks were problematic when the symlink pointed out of the tool directory. This was not a problem when uploading to the tool shed, because we'd dereference the symlinks when creating the repository archive. So here we just copy the tool tree with shutil.copytree, which dereferences symlinks by default.
2a089ed to
51f0021
Compare
Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com>
8656796 to
d1591ab
Compare
|
I've tested this with a fake tool and it works correctly if the |
|
Yes, that is what I intended, I don't think you'll want to overwrite symlink targets. |
|
As far as I understand #857 this was mostly an issue with having test data point out of the runnable directory, which Galaxy doesn't allow. That will work fine with this PR, you'll just have to take care with |
|
OK, let's see if @bernt-matthias has anything to add. I seem to be able to replicate the same behaviour with just these changes: diff --git a/planemo/galaxy/test/actions.py b/planemo/galaxy/test/actions.py
index 92cda85..4cf9c8b 100644
--- a/planemo/galaxy/test/actions.py
+++ b/planemo/galaxy/test/actions.py
@@ -3,9 +3,9 @@
import io
import json
import os
+from distutils.dir_util import copy_tree
import click
-from galaxy.tool_util.deps.commands import shell
from galaxy.util import unicodify
from planemo.exit_codes import (
@@ -96,8 +96,7 @@ def run_in_config(ctx, config, run=run_galaxy_command, **kwds):
action
)
if kwds.get('update_test_data', False):
- update_cp_args = (job_output_files, config.test_data_dir)
- shell('cp -r "%s"/* "%s"' % update_cp_args)
+ copy_tree(job_output_files, config.test_data_dir)
_check_test_outputs(xunit_report_file_tracker, structured_report_file_tracker)
test_results = test_structures.GalaxyTestResults(Are the other changes needed? In case, if you can add some comments explaining the reason, thanks! |
The diff you posted will not expand symlinks in the runnable location, so when the test tool interactor asks for the test files from Galaxy Galaxy will deny this https://github.com/mvdbeek/galaxy/blob/fdfdcc50b45ea692e747db7cf05f9adac235ae72/lib/galaxy/tools/__init__.py#L972. That is the cause of #857 and #865. I mostly wrote this for dockerized tests where on top of these restrictions the symlink target won't be mounted in leading to broken symlinks, not just in the test data but also for symlinked scripts as in ruvseq. If you want to check this for yourself I'd suggest running We don't have any iuc tools around that would elicit #857, but you can simulate that with That'll fail with |
|
This is a lot of magic outside of Galaxy 😟. I don't know what to do otherwise though, thanks for the fixes. |
|
Thanks @jmchilton! If it is any consolation this brings the test closer to what is being uploaded to the toolshed. Another alternative would have been to do some staging on the Galaxy side, which I think pulsar does anyway ? |
Fixes #857 and #865
Symlinks were problematic when the symlink pointed out of the tool directory. This was not a problem when uploading to the tool shed, because we'd dereference the symlinks when creating the repository archive. So here we just copy the tool tree with
shutil.copytree, which dereferences symlinks by default.