galaxyproject / planemo

Command-line utilities to assist in developing Galaxy and Common Workflow Language artifacts - including tools, workflows, and training materials.
https://planemo.readthedocs.io/
MIT License
90 stars 85 forks source link

Allow test-data to be symlink #865

Closed mvdbeek closed 2 years ago

mvdbeek commented 6 years ago

At least the simple case where the test-data directory is a symlink to somewhere else fails. This might be a Galaxy issue, not sure.

mvdbeek commented 6 years ago

fwiw the error is:

Traceback (most recent call last):
  File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpmgem8dw6/galaxy-dev/test/functional/test_toolbox.py", line 88, in test_tool
    self.do_it(tool_version=tool_version, test_index=test_index)
  File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpmgem8dw6/galaxy-dev/test/functional/test_toolbox.py", line 41, in do_it
    verify_tool(tool_id, self.galaxy_interactor, resource_parameters=resource_parameters, test_index=test_index, tool_version=tool_version, register_job_data=register_job_data)
  File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpmgem8dw6/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 653, in verify_tool
    stage_data_in_history(galaxy_interactor, tool_id, testdef.test_data(), test_history)
  File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpmgem8dw6/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 59, in stage_data_in_history
    upload_wait = galaxy_interactor.stage_data_async(test_data, history, tool_id)
  File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpmgem8dw6/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 267, in stage_data_async
    file_name = self.test_data_path(tool_id, fname)
  File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpmgem8dw6/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 232, in test_data_path
    assert response.status_code == 200
AssertionError
mvdbeek commented 6 years ago

Hmm, I guess this is actually a security feature on Galaxy's side to not let the test-data be outside of the test-data dir. It would actually be handy for planemo testing when we can share input files. Would we want to make an exception for instances raised by planemo, e.g by having an environment variable or config setting that allows this ?

mvdbeek commented 6 years ago

On the other hand is this a realistic attack vector ? I mean you'd already need to somehow have a tool whose symlinks are manipulated, so in a sense your system is already compromised. We could instead disallow (if we don't already do this) the upload of tools that use symlinks for their test-data ?

suhaibMo commented 6 years ago

I've had same issue while running a test where test-data is within the folders while initiating planemo testing. Does indicate the issue is with the Galaxy instance. ?


  File "/private/var/folders/0j/h_hw9q7s3d5b8l647l097rjh261_3j/T/tmpeay_ykjw/galaxy-dev/test/functional/test_toolbox.py", line 88, in test_tool
    self.do_it(tool_version=tool_version, test_index=test_index)
  File "/private/var/folders/0j/h_hw9q7s3d5b8l647l097rjh261_3j/T/tmpeay_ykjw/galaxy-dev/test/functional/test_toolbox.py", line 41, in do_it
    verify_tool(tool_id, self.galaxy_interactor, resource_parameters=resource_parameters, test_index=test_index, tool_version=tool_version, register_job_data=register_job_data)
  File "/private/var/folders/0j/h_hw9q7s3d5b8l647l097rjh261_3j/T/tmpeay_ykjw/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 653, in verify_tool
    stage_data_in_history(galaxy_interactor, tool_id, testdef.test_data(), test_history)
  File "/private/var/folders/0j/h_hw9q7s3d5b8l647l097rjh261_3j/T/tmpeay_ykjw/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 59, in stage_data_in_history
    upload_wait = galaxy_interactor.stage_data_async(test_data, history, tool_id)
  File "/private/var/folders/0j/h_hw9q7s3d5b8l647l097rjh261_3j/T/tmpeay_ykjw/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 267, in stage_data_async
    file_name = self.test_data_path(tool_id, fname)
  File "/private/var/folders/0j/h_hw9q7s3d5b8l647l097rjh261_3j/T/tmpeay_ykjw/galaxy-dev/lib/galaxy/tools/verify/interactor.py", line 232, in test_data_path
    assert response.status_code == 200
AssertionError``` 
mvdbeek commented 6 years ago

Can you elaborate what you are doing ?

bernt-matthias commented 6 years ago

Also symbolic links in the test-data dir seem not to work: https://github.com/galaxyproject/planemo/issues/857

lecorguille commented 5 years ago

👍

I have the same issue with my repository. I used to symlink test-data because some are shared between tools. Some aren't so light :/

https://github.com/workflow4metabolomics/xcms/tree/dev/tools/xcms_fillpeaks/test-data

I have to downgrade the Galaxy version to 17.05

Not mandatory but I will be happy to get that back :)

mvdbeek commented 2 years ago

I think this is all working now.